Diagnostics to report slow/inefficient operations in ApplyPhysics

So we can get to the bottom of the high CPU usage.

--- OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -1781,23 +1781,42 @@
         /// <param name="m_physicalPrim"></param>
         public void ApplyPhysics(bool allowPhysicalPrims, bool fromStorage)
         {
+            // Some diagnostic thresholds for reporting slow/inefficient operations.
+            const int SLOW_CALC_THRESHOLD = 1000;   // > this in ms considered slow calc
+            const int PHYS_PRIMS_THRESHOLD = 16; // > this reports many physical prims
+
             if (!m_rootPart.PhysicsSummary.NeedsPhysicsShape)
                 return;

             if (m_childParts.Count > 1)
             {
                 List<BulkShapeData> allParts = new List<BulkShapeData>();
-                allParts.Add(m_rootPart.GenerateBulkShapeData());
-
-                m_childParts.ForEachPart((SceneObjectPart part) => {
-                    if (part.LocalId != m_rootPart.LocalId)
-                    {
-                        if (part.RequiresPhysicalShape)
+                int count = 1;
+                Vector3 pos = this.AbsolutePosition;
+                string prefix = String.Format("[SCENE]: Slow GenerateBulkShapeData for '{0}' at {1}/{2}/{3} ", this.Name, (int)pos.X, (int)pos.Y, (int)pos.Z);
+                Util.ReportIfSlow(prefix+"(object)", SLOW_CALC_THRESHOLD, () =>
+                {
+                    Util.ReportIfSlow(prefix+"(root)", SLOW_CALC_THRESHOLD, () =>
+                    {
+                        allParts.Add(m_rootPart.GenerateBulkShapeData());
+                    });
+
+                    m_childParts.ForEachPart((SceneObjectPart part) => {
+                        if (part.LocalId != m_rootPart.LocalId)
                         {
-                            allParts.Add(part.GenerateBulkShapeData());
+                            if (part.RequiresPhysicalShape)
+                            {
+                                count++;
+                                Util.ReportIfSlow(prefix+"(#"+part.LinkNum.ToString()+")", SLOW_CALC_THRESHOLD, () =>
+                                {
+                                    allParts.Add(part.GenerateBulkShapeData());
+                                });
+                            }
                         }
-                    }
+                    });
                 });
+                if (count > PHYS_PRIMS_THRESHOLD)
+                    m_log.WarnFormat("[SCENE]: ApplyPhysics object included {0} physical prims.", count);

                 m_scene.PhysicsScene.BulkAddPrimShapes(allParts, m_rootPart.GeneratePhysicsAddPrimShapeFlags(allowPhysicalPrims, fromStorage));


Physical objects are now stopped at parcel borders if no parcel access.

--- OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -626,8 +626,19 @@
                     ParcelPropertiesStatus reason;
                     if (NewParcel.DenyParcelAccess(this, out reason))
                     {
-                        val = currentPos;           // undo the position change
-                        physicsTriggered = false;   // forced update
+                        if (physicsTriggered)
+                        {
+                            bool wasSelected = this.IsSelected;
+                            this.IsSelected = true; // force kinematic
+
+                            this.SetVelocity(Vector3.Zero, false);
+                            m_rootPart.SetGroupPosition(val, false, false); // not physicsTriggered
+
+                            if (!wasSelected) this.IsSelected = false;  // restore kinematic state
+                            return; // it was a physical move, we're done.
+                        }
+
+                        val = currentPos;           // force undo the position change and continue
                     }
                 }


fixed issue

fixed issue

--- Presentation.Web/Controllers/API/ExcelController.cs
+++ Presentation.Web/Controllers/API/ExcelController.cs
@@ -35,7 +35,8 @@
             result.Content.Headers.ContentType = new MediaTypeHeaderValue(mimeType);
             result.Content.Headers.ContentDisposition = new ContentDispositionHeaderValue("attachment")
             {
-                FileName = filename
+                FileNameStar = filename,
+                DispositionType = "ISO-8859-1"
             };
             return result;

@@ -56,7 +57,8 @@
             result.Content.Headers.ContentType = new MediaTypeHeaderValue(mimeType);
             result.Content.Headers.ContentDisposition = new ContentDispositionHeaderValue("attachment")
             {
-                FileName = filename
+                FileNameStar = filename,
+                DispositionType = "ISO-8859-1"
             };
             return result;


Fixes #99

Fixes #99

Had a leak similar to issue #90 but in C2DM as it was only fixed for GCM

--- PushSharp.Android/C2dm/C2dmMessageTransportAsync.cs
+++ PushSharp.Android/C2dm/C2dmMessageTransportAsync.cs
@@ -203,46 +203,52 @@
 			{
 				ResponseCode = MessageTransportResponseCode.Error,
 				ResponseStatus = MessageTransportResponseStatus.Error,
-				Message = asyncParam.Message,
+				Message = asyncParam != null ? asyncParam.Message : null,
 				MessageId = string.Empty
 			};

-			if (asyncParam.WebResponse.StatusCode == HttpStatusCode.Unauthorized)
-			{
-				//401 bad auth token
-				result.ResponseCode = MessageTransportResponseCode.InvalidAuthToken;
-				result.ResponseStatus = MessageTransportResponseStatus.Error;
-				//throw new InvalidAuthenticationTokenTransportException(result);
-			}
-			else if (asyncParam.WebResponse.StatusCode == HttpStatusCode.ServiceUnavailable)
-			{
-				//First try grabbing the retry-after header and parsing it.
-				TimeSpan retryAfter = new TimeSpan(0, 0, 120);
-
-				var wrRetryAfter = asyncParam.WebResponse.GetResponseHeader("Retry-After");
-
-				if (!string.IsNullOrEmpty(wrRetryAfter))
-				{
-					DateTime wrRetryAfterDate = DateTime.UtcNow;
-
-					if (DateTime.TryParse(wrRetryAfter, out wrRetryAfterDate))
-						retryAfter = wrRetryAfterDate - DateTime.UtcNow;
-					else
-					{
-						int wrRetryAfterSeconds = 120;
-						if (int.TryParse(wrRetryAfter, out wrRetryAfterSeconds))
-							retryAfter = new TimeSpan(0, 0, wrRetryAfterSeconds);
-					}
-				}
-
-				//503 exponential backoff, get retry-after header
-				result.ResponseCode = MessageTransportResponseCode.ServiceUnavailable;
-				result.ResponseStatus = MessageTransportResponseStatus.Error;
-
-				throw new ServiceUnavailableTransportException(retryAfter, result);
-			}
-
-			asyncParam.WebResponse.Close();
+			try
+			{
+				if (asyncParam.WebResponse.StatusCode == HttpStatusCode.Unauthorized)
+				{
+					//401 bad auth token
+					result.ResponseCode = MessageTransportResponseCode.InvalidAuthToken;
+					result.ResponseStatus = MessageTransportResponseStatus.Error;
+					//throw new InvalidAuthenticationTokenTransportException(result);
+				}
+				else if (asyncParam.WebResponse.StatusCode == HttpStatusCode.ServiceUnavailable)
+				{
+					//First try grabbing the retry-after header and parsing it.
+					TimeSpan retryAfter = new TimeSpan(0, 0, 120);
+
+					var wrRetryAfter = asyncParam.WebResponse.GetResponseHeader("Retry-After");
+
+					if (!string.IsNullOrEmpty(wrRetryAfter))
+					{
+						DateTime wrRetryAfterDate = DateTime.UtcNow;
+
+						if (DateTime.TryParse(wrRetryAfter, out wrRetryAfterDate))
+							retryAfter = wrRetryAfterDate - DateTime.UtcNow;
+						else
+						{
+							int wrRetryAfterSeconds = 120;
+							if (int.TryParse(wrRetryAfter, out wrRetryAfterSeconds))
+								retryAfter = new TimeSpan(0, 0, wrRetryAfterSeconds);
+						}
+					}
+
+					//503 exponential backoff, get retry-after header
+					result.ResponseCode = MessageTransportResponseCode.ServiceUnavailable;
+					result.ResponseStatus = MessageTransportResponseStatus.Error;
+
+					throw new ServiceUnavailableTransportException(retryAfter, result);
+				}
+			}
+			finally
+			{
+				if (asyncParam != null && asyncParam.WebResponse != null)
+					asyncParam.WebResponse.Close();
+			}

 			if (MessageResponseReceived != null)
 				MessageResponseReceived(result);


Changed default values for the default map gen module

Reduced default weight and length from 75 to 45. Also cleaned up
internal validation logic.

--- Scripts/Internal/MapGeneration/Map/MapParameters.cs
+++ Scripts/Internal/MapGeneration/Map/MapParameters.cs
@@ -4,8 +4,8 @@
 namespace CaveGeneration.MapGeneration
 {
     /// <summary>
-    /// Convenience class for passing parameters for the map generator across interfaces. Properties can be set through
-    /// code or inspector.
+    /// Convenience class that groups up the properties for a cellular automata map generator and all the defaults and
+    /// validation logic.
     /// </summary>
     [Serializable]
     public sealed class MapParameters
@@ -115,26 +115,26 @@

         #region VALUES
         const int MINIMUM_LENGTH = 5;
-        const int DEFAULT_LENGTH = 75;
+        const int DEFAULT_LENGTH = 45;
         const int MAXIMUM_LENGTH = short.MaxValue;

         const int MINIMUM_WIDTH = 5;
-        const int DEFAULT_WIDTH = 75;
+        const int DEFAULT_WIDTH = 45;
         const int MAXIMUM_WIDTH = short.MaxValue;

         const int MINIMUM_BORDER_SIZE = 0;
         const int DEFAULT_BORDER_SIZE = 1;
-        const int MAXIMUM_BORDER_SIZE = 1000;
+        const int MAXIMUM_BORDER_SIZE = ushort.MaxValue;

         const float MINIMUM_MAP_DENSITY = 0f;
         const float DEFAULT_MAP_DENSITY = 0.5f;
         const float MAXIMUM_MAP_DENSITY = 1f;

         const int MINIMUM_FLOOR_THRESHOLD = 0;
-        const int DEFAULT_FLOOR_THRESHOLD = 50;
+        const int DEFAULT_FLOOR_THRESHOLD = 25;

         const int MINIMUM_WALL_THRESHOLD = 0;
-        const int DEFAULT_WALL_THRESHOLD = 50;
+        const int DEFAULT_WALL_THRESHOLD = 25;
         #endregion

         public MapParameters()
@@ -171,41 +171,41 @@

         void SetLength(int value)
         {
-            SetParameter(ref length, value, MINIMUM_LENGTH, MAXIMUM_LENGTH);
+            ValidateArgument(value, MINIMUM_LENGTH, MAXIMUM_LENGTH, "Length");
+            length = value;
         }

         void SetWidth(int value)
         {
-            SetParameter(ref width, value, MINIMUM_WIDTH, MAXIMUM_WIDTH);
+            ValidateArgument(value, MINIMUM_WIDTH, MAXIMUM_WIDTH, "Width");
+            width = value;
         }

         void SetBorderSize(int value)
         {
-            SetParameter(ref borderSize, value, MINIMUM_BORDER_SIZE, MAXIMUM_BORDER_SIZE);
+            ValidateArgument(value, MINIMUM_BORDER_SIZE, MAXIMUM_BORDER_SIZE, "Border");
+            borderSize = value;
         }

         void SetMapDensity(float value)
         {
-            SetParameter(ref initialMapDensity, value, MINIMUM_MAP_DENSITY, MAXIMUM_MAP_DENSITY);
-        }
-
-        void SetParameter<T>(ref T parameter, T value, T minimum, T maximum) where T: IComparable<T>
+            ValidateArgument(value, MINIMUM_MAP_DENSITY, MAXIMUM_MAP_DENSITY, "Map density");
+            initialMapDensity = value;
+        }
+
+        void ValidateArgument<T>(T value, T minimum, T maximum, string name) where T : IComparable<T>
         {
             bool tooSmall = value.CompareTo(minimum) == -1;
             bool tooBig = value.CompareTo(maximum) == 1;
             if (tooSmall)
             {
-                const string smallErrorFormat = "Parameter {0} must be at least {1}.";
-                throw new ArgumentOutOfRangeException(string.Format(smallErrorFormat, parameter, minimum));
+                const string smallErrorFormat = "{0} must be at least {1}.";
+                throw new ArgumentOutOfRangeException(string.Format(smallErrorFormat, name, minimum));
             }
             else if (tooBig)
             {
-                const string largeErrorFormat = "Parameter {0} must be at most {1}.";
-                throw new ArgumentOutOfRangeException(string.Format(largeErrorFormat, parameter, maximum));
-            }
-            else
-            {
-                parameter = value;
+                const string largeErrorFormat = "{0} must be at most {1}.";
+                throw new ArgumentOutOfRangeException(string.Format(largeErrorFormat, name, maximum));
             }
         }
     }


DE4333: if there isn't a room open for a child, then a sticker will print out that the room is at capacity instead of breaking the system

--- SignInCheckIn/SignInCheckIn/Services/SignInLogic.cs
+++ SignInCheckIn/SignInCheckIn/Services/SignInLogic.cs
@@ -168,9 +168,12 @@
             // return all event rooms which match up to groups on the events
             var eventGroups = _eventRepository.GetEventGroupsByGroupIdAndEventIds(groupId, eventIds);
             var eventRoomIds = eventGroups.Select(r => r.RoomReservationId.GetValueOrDefault()).ToList();
-            var eventRooms = _roomRepository.GetEventRoomsByEventRoomIds(eventRoomIds).ToList();
-
-            return eventRooms;
+            if (eventRoomIds.Count > 0)
+            {
+                return _roomRepository.GetEventRoomsByEventRoomIds(eventRoomIds).ToList();
+            }
+
+            return new List<MpEventRoomDto>();
         }

         // set assignments for non-ac rooms here -- this is not picking up when a partici


Correciones en Calendario

Correciones en Calendario

--- Signum.Engine/Schema/SchemaBuilder/SchemaBuilder.cs
+++ Signum.Engine/Schema/SchemaBuilder/SchemaBuilder.cs
@@ -63,6 +63,11 @@
             Field[] colFieldsNotNull = fieldsNotNullLambdas.Select(fun => schema.Field<T>(fun)).ToArray();

             AddUniqueIndex(new UniqueIndex(schema.Table<T>(), colFields).WhereNotNull(colFieldsNotNull));
+        }
+        public void AddUniqueIndexMList<T, V>(Expression<Func<T, MList<V>>> toMList, Expression<Func<MListElement<T, V>, object>> fields)
+           where T : IdentifiableEntity
+        {
+            AddUniqueIndexMList(toMList, fields, null);
         }

         public void AddUniqueIndexMList<T, V>(Expression<Func<T, MList<V>>> toMList, Expression<Func<MListElement<T, V>, object>> fields, Expression<Func<MListElement<T, V>, object>> fieldsNotNull)


Refactored label rendering for "label should fit text"

--- Source/Engine/AGS.Engine/UI/Text/GLLabelRenderer.cs
+++ Source/Engine/AGS.Engine/UI/Text/GLLabelRenderer.cs
@@ -110,10 +110,6 @@
                new PointF(GLText.TextResolutionFactorX, GLText.TextResolutionFactorY), out resolutionFactor,
                out resolution);

-            if (getAutoFit() == AutoFit.LabelShouldFitText)
-            {
-                _glUtils.AdjustResolution(resolution.Width, resolution.Height);
-            }
             _bgRenderer.Render(obj, viewport);

             if (TextVisible && Text != "")
@@ -150,10 +146,14 @@
             AutoFit autoFit = getAutoFit();
 			float height = obj.Height;
 			float width = obj.Width;
+
+            var scaleUpText = hitTestResolutionFactor;
+            var scaleDownText = renderResolutionFactor.Equals(noFactor) ? hitTestResolutionFactor : noFactor;
+
             if (autoFit == AutoFit.LabelShouldFitText)
             {
-                updateText(_glTextHitTest, GLText.EmptySize, renderResolutionFactor, noFactor, int.MaxValue);
-                updateText(_glTextRender, GLText.EmptySize, renderResolutionFactor, noFactor, int.MaxValue);
+                updateText(_glTextHitTest, GLText.EmptySize, scaleUpText, scaleDownText, int.MaxValue);
+                updateText(_glTextRender, GLText.EmptySize, scaleUpText, scaleDownText, int.MaxValue);
                 CustomImageSize = new SizeF(_glTextHitTest.Width, _glTextHitTest.Height);
             }
             else CustomImageSize = BaseSize;
@@ -168,17 +168,8 @@
             IGLMatrices textHitTestMatrices = resolutionMatches ? textRenderMatrices : obj.RenderLayer.IndependentResolution == null ? labelRenderMatrices : new GLMatrices { ModelMatrix = modelMatrices.InVirtualResolutionMatrix, ViewportMatrix = viewportMatrix };
             IGLMatrices labelHitTestMatrices = obj.RenderLayer.IndependentResolution == null ? labelRenderMatrices : textHitTestMatrices;

-            var scaleUpText = hitTestResolutionFactor;
-            var scaleDownText = renderResolutionFactor.Equals(noFactor) ? hitTestResolutionFactor : noFactor;
-            if (autoFit == AutoFit.LabelShouldFitText)
-            {
-                hitTestResolutionFactor = new PointF(1f / hitTestResolutionFactor.X, 1f / hitTestResolutionFactor.Y);
-            }
-            else
-            {
-                if (renderResolutionFactor.Equals(hitTestResolutionFactor)) hitTestResolutionFactor = noFactor;
-                renderResolutionFactor = noFactor;
-            }
+            if (renderResolutionFactor.Equals(hitTestResolutionFactor)) hitTestResolutionFactor = noFactor;
+            renderResolutionFactor = noFactor;

             updateBoundingBoxes(_glTextHitTest, autoFit, textHitTestMatrices, labelHitTestMatrices, scaleUpText, noFactor, hitTestResolutionFactor, resolutionMatches, true);
             if (!resolutionMatches) updateBoundingBoxes(_glTextRender, autoFit, textRenderMatrices, labelRenderMatrices, scaleUpText, scaleDownText, renderResolutionFactor, true, false);
@@ -202,7 +193,7 @@
                     _boundingBoxBuilder.Build(_labelBoundingBoxes, BaseSize.Width / labelResolutionFactor.X, BaseSize.Height, labelMatrices, buildRenderBox, buildHitTestBox);
                     updateText(glText, GLText.EmptySize, textScaleUp, textScaleDown, (int?)BaseSize.Width);
                     _boundingBoxBuilder.Build(_textBoundingBoxes, glText.BitmapWidth, glText.BitmapHeight, textMatrices, buildRenderBox, buildHitTestBox);
-                    _boundingBoxBuilder.Build(_labelBoundingBoxes, BaseSize.Width / labelResolutionFactor.Y, glText.Height / labelResolutionFactor.Y, labelMatrices, buildRenderBox, buildHitTestBox);
+                    _boundingBoxBuilder.Build(_labelBoundingBoxes, BaseSize.Width / labelResolutionFactor.X, glText.Height / labelResolutionFactor.Y, labelMatrices, buildRenderBox, buildHitTestBox);

                     _usedLabelBoundingBoxes = _labelBoundingBoxes;
                     _usedTextBoundingBoxes = _textBoundingBoxes;
@@ -223,8 +214,7 @@

                 case AutoFit.LabelShouldFitText:
                     _boundingBoxBuilder.Build(_textBoundingBoxes, glText.BitmapWidth, glText.BitmapHeight, textMatrices, buildRenderBox, buildHitTestBox);
-                    _boundingBoxBuilder.Build(_labelBoundingBoxes, glText.Width * labelResolutionFactor.X, glText.Height * labelResolutionFactor.Y,
-                        textMatrices, buildRenderBox, buildHitTestBox);
+                    _boundingBoxBuilder.Build(_labelBoundingBoxes, glText.Width / labelResolutionFactor.X, glText.Height / labelResolutionFactor.Y, labelMatrices, buildRenderBox, buildHitTestBox);

                     _usedLabelBoundingBoxes = _labelBoundingBoxes;
                     _usedTextBoundingBoxes = _textBoundingBoxes;


OSX: Add File->Close by default for Application.GetSystemActions

--- Source/Eto.Platform.Mac/Forms/ApplicationHandler.cs
+++ Source/Eto.Platform.Mac/Forms/ApplicationHandler.cs
@@ -148,12 +148,16 @@
 			args.Actions.Add (new MacButtonAction ("mac_toggleFullScreen", "Enter Full Screen", "toggleFullScreen:") { Accelerator = Key.Application | Key.Control | Key.F });

 			if (addStandardItems) {
-				var file = args.Menu.FindAddSubMenu (Widget.Name ?? "Application", 100);
-				file.Actions.AddSeparator (800);
-				file.Actions.Add ("mac_hide", 800);
-				file.Actions.Add ("mac_hideothers", 800);
-				file.Actions.Add ("mac_showall", 800);
-				file.Actions.AddSeparator (801);
+				var application = args.Menu.FindAddSubMenu (Widget.Name ?? "Application", 100);
+				application.Actions.AddSeparator (800);
+				application.Actions.Add ("mac_hide", 800);
+				application.Actions.Add ("mac_hideothers", 800);
+				application.Actions.Add ("mac_showall", 800);
+				application.Actions.AddSeparator (801);
+
+				var file = args.Menu.FindAddSubMenu ("&File", 100);
+				file.Actions.AddSeparator (900);
+				file.Actions.Add ("mac_performClose", 900);

 				var edit = args.Menu.FindAddSubMenu ("&Edit", 200);
 				edit.Actions.AddSeparator (100);


Remove unused file.

Remove unused file.

--- Source/FakeItEasy/VisualBasic/VisualBasicHelpers.cs
+++ Source/FakeItEasy/VisualBasic/VisualBasicHelpers.cs
@@ -1,16 +0,0 @@
-namespace FakeItEasy.VisualBasic
-{
-    using System;
-    using System.Collections.Generic;
-    using System.Linq;
-    using System.Text;
-    using FakeItEasy.Configuration;
-
-    /// <summary>
-    /// Provides extensions for the Visual basic configuration.
-    /// </summary>
-    public static class VisualBasicHelpers
-    {
-
-    }
-}


Fix comment for IsViewCubeEdgeClicksEnabled

--- Source/HelixToolkit.Wpf/Controls/HelixViewport3D.cs
+++ Source/HelixToolkit.Wpf/Controls/HelixViewport3D.cs
@@ -1872,7 +1872,10 @@
                 this.SetValue(IsMoveEnabledProperty, value);
             }
         }
-
+
+        /// <summary>
+        /// Gets or sets the view cube edge clickable.
+        /// </summary>
         public bool IsViewCubeEdgeClicksEnabled
         {
             get { return (bool)GetValue(IsViewCubeEdgeClicksEnabledProperty); }
@@ -3889,4 +3892,4 @@
             this.viewCubeViewport.AnimateOpacity(this.ViewCubeOpacity, 200);
         }
     }
-}+}


GSF.Core: Added ExecuteNonQuery, ExecuteReader, ExecuteScalar, RetrieveRow, RetrieveData, and RetrieveDataSet methods to AdoDataConnection to greatly simplify cross-database queries.

git-tfs-id: [https://tfs.codeplex.com/tfs/TFS07]$/gsf/Main;C91566

--- Source/Libraries/GSF.Core/Data/AdoDataConnection.cs
+++ Source/Libraries/GSF.Core/Data/AdoDataConnection.cs
@@ -442,6 +442,221 @@
         #region [ Methods ]

         /// <summary>
+        /// Executes the SQL statement using <see cref="Connection"/>, and returns the number of rows affected.
+        /// </summary>
+        /// <param name="sqlFormat">Format string for the SQL statement to be executed.</param>
+        /// <param name="parameters">The parameter values to be used to fill in <see cref="IDbDataParameter"/> parameters.</param>
+        /// <returns>The number of rows affected.</returns>
+        public int ExecuteNonQuery(string sqlFormat, params object[] parameters)
+        {
+            return ExecuteNonQuery(DataExtensions.DefaultTimeoutDuration, sqlFormat, parameters);
+        }
+
+        /// <summary>
+        /// Executes the SQL statement using <see cref="Connection"/>, and returns the number of rows affected.
+        /// </summary>
+        /// <param name="timeout">The time in seconds to wait for the SQL statement to execute.</param>
+        /// <param name="sqlFormat">Format string for the SQL statement to be executed.</param>
+        /// <param name="parameters">The parameter values to be used to fill in <see cref="IDbDataParameter"/> parameters.</param>
+        /// <returns>The number of rows affected.</returns>
+        public int ExecuteNonQuery(int timeout, string sqlFormat, params object[] parameters)
+        {
+            string sql = GenericParameterizedQueryString(sqlFormat, parameters);
+            FixParameters(parameters);
+            return Connection.ExecuteNonQuery(sql, timeout, parameters);
+        }
+
+        /// <summary>
+        /// Executes the SQL statement using <see cref="Connection"/>, and builds a <see cref="IDataReader"/>.
+        /// </summary>
+        /// <param name="sqlFormat">Format string for the SQL statement to be executed.</param>
+        /// <param name="parameters">The parameter values to be used to fill in <see cref="IDbDataParameter"/> parameters.</param>
+        /// <returns>A <see cref="IDataReader"/> object.</returns>
+        public IDataReader ExecuteReader(string sqlFormat, params object[] parameters)
+        {
+            return ExecuteReader(DataExtensions.DefaultTimeoutDuration, sqlFormat, parameters);
+        }
+
+        /// <summary>
+        /// Executes the SQL statement using <see cref="Connection"/>, and builds a <see cref="IDataReader"/>.
+        /// </summary>
+        /// <param name="timeout">The time in seconds to wait for the SQL statement to execute.</param>
+        /// <param name="sqlFormat">Format string for the SQL statement to be executed.</param>
+        /// <param name="parameters">The parameter values to be used to fill in <see cref="IDbDataParameter"/> parameters.</param>
+        /// <returns>A <see cref="IDataReader"/> object.</returns>
+        public IDataReader ExecuteReader(int timeout, string sqlFormat, params object[] parameters)
+        {
+            string sql = GenericParameterizedQueryString(sqlFormat, parameters);
+            FixParameters(parameters);
+            return Connection.ExecuteReader(sql, timeout, parameters);
+        }
+
+        /// <summary>
+        /// Executes the SQL statement using <see cref="Connection"/>, and returns the value in the first column
+        /// of the first row in the result set as type <see cref="T"/>.
+        /// </summary>
+        /// <param name="sqlFormat">Format string for the SQL statement to be executed.</param>
+        /// <param name="parameters">The parameter values to be used to fill in <see cref="IDbDataParameter"/> parameters.</param>
+        /// <returns>Value in the first column of the first row in the result set.</returns>
+        public T ExecuteScalar<T>(string sqlFormat, params object[] parameters)
+        {
+            return ExecuteScalar<T>(DataExtensions.DefaultTimeoutDuration, sqlFormat, parameters);
+        }
+
+        /// <summary>
+        /// Executes the SQL statement using <see cref="Connection"/>, and returns the value in the first column
+        /// of the first row in the result set as type <see cref="T"/>.
+        /// </summary>
+        /// <param name="timeout">The time in seconds to wait for the SQL statement to execute.</param>
+        /// <param name="sqlFormat">Format string for the SQL statement to be executed.</param>
+        /// <param name="parameters">The parameter values to be used to fill in <see cref="IDbDataParameter"/> parameters.</param>
+        /// <returns>Value in the first column of the first row in the result set.</returns>
+        public T ExecuteScalar<T>(int timeout, string sqlFormat, params object[] parameters)
+        {
+            return ExecuteScalar(default(T), timeout, sqlFormat, parameters);
+        }
+
+        /// <summary>
+        /// Executes the SQL statement using <see cref="Connection"/>, and returns the value in the first column
+        /// of the first row in the result set as type <see cref="T"/>, substituting <paramref name="defaultValue"/>
+        /// if <see cref="DBNull.Value"/> is retrieved.
+        /// </summary>
+        /// <param name="defaultValue">The value to be substituted if <see cref="DBNull.Value"/> is retrieved.</param>
+        /// <param name="sqlFormat">Format string for the SQL statement to be executed.</param>
+        /// <param name="parameters">The parameter values to be used to fill in <see cref="IDbDataParameter"/> parameters.</param>
+        /// <returns>Value in the first column of the first row in the result set.</returns>
+        public T ExecuteScalar<T>(T defaultValue, string sqlFormat, params object[] parameters)
+        {
+            return ExecuteScalar(defaultValue, DataExtensions.DefaultTimeoutDuration, sqlFormat, parameters);
+        }
+
+        /// <summary>
+        /// Executes the SQL statement using <see cref="Connection"/>, and returns the value in the first column
+        /// of the first row in the result set as type <see cref="T"/>, substituting <paramref name="defaultValue"/>
+        /// if <see cref="DBNull.Value"/> is retrieved.
+        /// </summary>
+        /// <param name="defaultValue">The value to be substituted if <see cref="DBNull.Value"/> is retrieved.</param>
+        /// <param name="timeout">The time in seconds to wait for the SQL statement to execute.</param>
+        /// <param name="sqlFormat">Format string for the SQL statement to be executed.</param>
+        /// <param name="parameters">The parameter values to be used to fill in <see cref="IDbDataParameter"/> parameters.</param>
+        /// <returns>Value in the first column of the first row in the result set.</returns>
+        public T ExecuteScalar<T>(T defaultValue, int timeout, string sqlFormat, params object[] parameters)
+        {
+            object value = ExecuteScalar(timeout, sqlFormat, parameters);
+
+            if (value == DBNull.Value)
+                return defaultValue;
+
+            return (T)Convert.ChangeType(value, typeof(T));
+        }
+
+        /// <summary>
+        /// Executes the SQL statement using <see cref="Connection"/>, and returns the value in the first column
+        /// of the first row in the result set.
+        /// </summary>
+        /// <param name="sqlFormat">Format string for the SQL statement to be executed.</param>
+        /// <param name="parameters">The parameter values to be used to fill in <see cref="IDbDataParameter"/> parameters.</param>
+        /// <returns>Value in the first column of the first row in the result set.</returns>
+        public object ExecuteScalar(string sqlFormat, params object[] parameters)
+        {
+            return ExecuteScalar(DataExtensions.DefaultTimeoutDuration, sqlFormat, parameters);
+        }
+
+        /// <summary>
+        /// Executes the SQL statement using <see cref="Connection"/>, and returns the value in the first column
+        /// of the first row in the result set.
+        /// </summary>
+        /// <param name="timeout">The time in seconds to wait for the SQL statement to execute.</param>
+        /// <param name="sqlFormat">Format string for the SQL statement to be executed.</param>
+        /// <param name="parameters">The parameter values to be used to fill in <see cref="IDbDataParameter"/> parameters.</param>
+        /// <returns>Value in the first column of the first row in the result set.</returns>
+        public object ExecuteScalar(int timeout, string sqlFormat, params object[] parameters)
+        {
+            string sql = GenericParameterizedQueryString(sqlFormat, parameters);
+            FixParameters(parameters);
+            return Connection.ExecuteScalar(sql, timeout, parameters);
+        }
+
+        /// <summary>
+        /// Executes the SQL statement using <see cref="Connection"/>, and returns the first <see cref="DataRow"/> in the result set.
+        /// </summary>
+        /// <param name="sqlFormat">Format string for the SQL statement to be executed.</param>
+        /// <param name="parameters">The parameter values to be used to fill in <see cref="IDbDataParameter"/> parameters.</param>
+        /// <returns>The first <see cref="DataRow"/> in the result set.</returns>
+        public DataRow RetrieveRow(string sqlFormat, params object[] parameters)
+        {
+            return RetrieveRow(DataExtensions.DefaultTimeoutDuration, sqlFormat, parameters);
+        }
+
+        /// <summary>
+        /// Executes the SQL statement using <see cref="Connection"/>, and returns the first <see cref="DataRow"/> in the result set.
+        /// </summary>
+        /// <param name="timeout">The time in seconds to wait for the SQL statement to execute.</param>
+        /// <param name="sqlFormat">Format string for the SQL statement to be executed.</param>
+        /// <param name="parameters">The parameter values to be used to fill in <see cref="IDbDataParameter"/> parameters.</param>
+        /// <returns>The first <see cref="DataRow"/> in the result set.</returns>
+        public DataRow RetrieveRow(int timeout, string sqlFormat, params object[] parameters)
+        {
+            string sql = GenericParameterizedQueryString(sqlFormat, parameters);
+            FixParameters(parameters);
+            return Connection.RetrieveRow(m_adapterType, sql, timeout, parameters);
+        }
+
+        /// <summary>
+        /// Executes the SQL statement using <see cref="Connection"/>, and returns the first <see cref="DataTable"/>
+        /// of result set, if the result set contains at least one table.
+        /// </summary>
+        /// <param name="sqlFormat">Format string for the SQL statement to be executed.</param>
+        /// <param name="parameters">The parameter values to be used to fill in <see cref="IDbDataParameter"/> parameters.</param>
+        /// <returns>A <see cref="DataTable"/> object.</returns>
+        public DataTable RetrieveData(string sqlFormat, params object[] parameters)
+        {
+            return RetrieveData(DataExtensions.DefaultTimeoutDuration, sqlFormat, parameters);
+        }
+
+        /// <summary>
+        /// Executes the SQL statement using <see cref="Connection"/>, and returns the first <see cref="DataTable"/>
+        /// of result set, if the result set contains at least one table.
+        /// </summary>
+        /// <param name="timeout">The time in seconds to wait for the SQL statement to execute.</param>
+        /// <param name="sqlFormat">Format string for the SQL statement to be executed.</param>
+        /// <param name="parameters">The parameter values to be used to fill in <see cref="IDbDataParameter"/> parameters.</param>
+        /// <returns>A <see cref="DataTable"/> object.</returns>
+        public DataTable RetrieveData(int timeout, string sqlFormat, params object[] parameters)
+        {
+            string sql = GenericParameterizedQueryString(sqlFormat, parameters);
+            FixParameters(parameters);
+            return Connection.RetrieveData(m_adapterType, sql, timeout, parameters);
+        }
+
+        /// <summary>
+        /// Executes the SQL statement using <see cref="Connection"/>, and returns the <see cref="DataSet"/> that
+        /// may contain multiple tables, depending on the SQL statement.
+        /// </summary>
+        /// <param name="sqlFormat">Format string for the SQL statement to be executed.</param>
+        /// <param name="parameters">The parameter values to be used to fill in <see cref="IDbDataParameter"/> parameters.</param>
+        /// <returns>A <see cref="DataSet"/> object.</returns>
+        public DataSet RetrieveDataSet(string sqlFormat, params object[] parameters)
+        {
+            return RetrieveDataSet(DataExtensions.DefaultTimeoutDuration, sqlFormat, parameters);
+        }
+
+        /// <summary>
+        /// Executes the SQL statement using <see cref="Connection"/>, and returns the <see cref="DataSet"/> that
+        /// may contain multiple tables, depending on the SQL statement.
+        /// </summary>
+        /// <param name="timeout">The time in seconds to wait for the SQL statement to execute.</param>
+        /// <param name="sqlFormat">Format string for the SQL statement to be executed.</param>
+        /// <param name="parameters">The parameter values to be used to fill in <see cref="IDbDataParameter"/> parameters.</param>
+        /// <returns>A <see cref="DataSet"/> object.</returns>
+        public DataSet RetrieveDataSet(int timeout, string sqlFormat, params object[] parameters)
+        {
+            string sql = GenericParameterizedQueryString(sqlFormat, parameters);
+            FixParameters(parameters);
+            return Connection.RetrieveDataSet(m_adapterType, sql, timeout, parameters);
+        }
+
+        /// <summary>
         /// Releases all the resources used by the <see cref="AdoDataConnection"/> object.
         /// </summary>
         public void Dispose()
@@ -562,6 +777,26 @@
             return type;
         }

+        private string GenericParameterizedQueryString(string sqlFormat, object[] parameters)
+        {
+            string[] parameterNames = parameters
+                .Select((parameter, index) => "p" + index)
+                .ToArray();
+
+            return ParameterizedQueryString(sqlFormat, parameterNames);
+        }
+
+        private void FixParameters(object[] parameters)
+        {
+            for (int i = 0; i < parameters.Length; i++)
+            {
+                if (parameters[i] is bool)
+                    parameters[i] = Bool((bool)parameters[i]);
+                else if (parameters[i] is Guid)
+                    parameters[i] = Guid((Guid)parameters[i]);
+            }
+        }
+
         #endregion

         #region [ Static ]


Fix bug

Fix bug

--- Source/Orleankka.Runtime/Behaviors/ActorBehavior.cs
+++ Source/Orleankka.Runtime/Behaviors/ActorBehavior.cs
@@ -83,7 +83,7 @@
         internal async Task<object> OnReceive(object message)
         {
             if (Default())
-                return ActorGrain.Unhandled;
+                return await actor.Dispatch(message);

             switch (message)
             {


Comment out long running test

Comment out long running test

--- Sources/Core.IntegrationTest/BusPerformanceTests.cs
+++ Sources/Core.IntegrationTest/BusPerformanceTests.cs
@@ -56,7 +56,7 @@
             }
         }

-        [Test]
+        [Test, Ignore("Too long for CI")]
         public void PublisherShouldCloseConnectionsOnDispose()
         {
             using (var bus = new RabbitMQBus())
@@ -68,7 +68,7 @@

                         try
                         {
-                            using (var publisher = bus.CreatePublisher())
+                            using (var publisher = bus.CreateRpcPublisher())
                             {
                                 publisher.Send(new Data());
                             }


参考サイトを追加

参考サイトを追加

--- Unity/OffScreenEffect/Assets/App/Scripts/Tracker.cs
+++ Unity/OffScreenEffect/Assets/App/Scripts/Tracker.cs
@@ -1,4 +1,5 @@
 // http://tsubakit1.hateblo.jp/entry/2016/04/26/233000
+// https://www.reddit.com/r/Unity2D/comments/3h7qt3/offscreen_enemy_indicator_script_in_comments/?
 using UnityEngine;
 using System.Collections;
 using UnityEngine.UI;


Quick fix attempt issue #3645

Quick fix attempt issue #3645

--- UnityProject/Assets/Scripts/Doors/DoorController.cs
+++ UnityProject/Assets/Scripts/Doors/DoorController.cs
@@ -357,9 +357,9 @@

 		private void ServerPressureWarn()
 		{
+			DoorUpdateMessage.SendToAll(gameObject, DoorUpdateType.PressureWarn);
 			pressureWarnActive = true;
 			StartCoroutine(PressureWarnDelay());
-			DoorUpdateMessage.SendToAll(gameObject, DoorUpdateType.PressureWarn);
 		}

 		/// <summary>


Update SingleDatabaseFixture.cs

Update SingleDatabaseFixture.cs

--- Unosquare.TenantCore.Tests/SingleDatabaseFixture.cs
+++ Unosquare.TenantCore.Tests/SingleDatabaseFixture.cs
@@ -2,6 +2,7 @@
 using Microsoft.Owin.Testing;
 using NUnit.Framework;
 using Owin;
+using System.Threading.Tasks;
 using System.Collections.Generic;
 using System.Linq;
 using Unosquare.TenantCore.SampleDatabase;


Event contract resolver - full of stupid issues

--- src/Aggregates.NET.GetEventStore/EventContractResolver.cs
+++ src/Aggregates.NET.GetEventStore/EventContractResolver.cs
@@ -26,17 +26,16 @@

         protected override JsonObjectContract CreateObjectContract(Type objectType)
         {
-            if (objectType.IsInterface && (objectType.IsAssignableFrom(typeof(IEvent)) || objectType.IsAssignableFrom(typeof(ISnapshot))))
-            {
-                var mappedType = _mapper.GetMappedTypeFor(objectType);
-                var objectContract = base.CreateObjectContract(mappedType);
+            var mappedTypeFor = _mapper.GetMappedTypeFor(objectType);

-                objectContract.DefaultCreator = () => _creator.CreateInstance(mappedType);
+            if (mappedTypeFor == null)
+                return base.CreateObjectContract(objectType);

-                return objectContract;
-            }
+            var objectContract = base.CreateObjectContract(mappedTypeFor);

-            return base.CreateObjectContract(objectType);
+            objectContract.DefaultCreator = () => _creator.CreateInstance(mappedTypeFor);
+
+            return objectContract;
         }
     }


Lower pool count.

Lower pool count.

--- src/Compilers/Core/Portable/Serialization/ObjectBinder.cs
+++ src/Compilers/Core/Portable/Serialization/ObjectBinder.cs
@@ -75,7 +75,7 @@
                 // then we don't want to keep around this version in the pool.
                 if (state.Version == s_version)
                 {
-                    if (s_pool.Count < 128)
+                    if (s_pool.Count < 32)
                     {
                         s_pool.Push(state);
                     }


Fix CodeFactor issue

Fix CodeFactor issue

--- WalletWasabi.Fluent/ViewModels/HomePageViewModel.cs
+++ WalletWasabi.Fluent/ViewModels/HomePageViewModel.cs
@@ -21,7 +21,7 @@

 			walletManager.Items.ToObservableChangeSet()
 				.Cast(x => x as NavBarItemViewModel)
-				.Sort(SortExpressionComparer<NavBarItemViewModel>.Ascending(i=>i.Title))
+				.Sort(SortExpressionComparer<NavBarItemViewModel>.Ascending(i => i.Title))
 				.Merge(list.Connect())
 				.ObserveOn(RxApp.MainThreadScheduler)
 				.Bind(out _items)


Added property Length to DataStructures.LinkedList.SinglyLinkedList

--- src/DataStructuresAlgorithms/DataStructures/LinkedList.cs
+++ src/DataStructuresAlgorithms/DataStructures/LinkedList.cs
@@ -28,6 +28,14 @@
             }
         }

+        public int Length
+        {
+            get
+            {
+                return Count;
+            }
+        }
+
         public int Count
         {
             get


fix bug.

fix bug.

--- src/Extensions/ENode.EQueue/Commanding/CommandConsumer.cs
+++ src/Extensions/ENode.EQueue/Commanding/CommandConsumer.cs
@@ -1,12 +1,14 @@
 using System;
 using System.Collections.Concurrent;
 using System.Collections.Generic;
+using System.Linq;
 using ECommon.IoC;
 using ECommon.Serializing;
 using ECommon.Socketing;
 using ECommon.Utilities;
 using ENode.Commanding;
 using ENode.Domain;
+using ENode.Eventing;
 using EQueue.Clients.Consumers;
 using EQueue.Protocols;
 using EQueue.Utils;
@@ -122,8 +124,13 @@
                 {
                     throw new ArgumentNullException("aggregateRoot");
                 }
+                var firstSourcingEvent = aggregateRoot.GetUncommittedEvents().FirstOrDefault(x => x is ISourcingEvent);
+                if (firstSourcingEvent == null)
+                {
+                    throw new NotSupportedException(string.Format("Aggregate [{0}] has no sourcing event, cannot be added.", aggregateRoot.GetType()));
+                }

-                _trackingAggregateRoots.TryAdd(aggregateRoot.UniqueId, aggregateRoot);
+                _trackingAggregateRoots.TryAdd(firstSourcingEvent.AggregateRootId, aggregateRoot);
             }
             /// <summary>Get the aggregate from the context.
             /// </summary>


Add the defaults for GeneratorOptions

Add the defaults for GeneratorOptions

--- src/ExternalTemplates.AspNet/IGeneratorOptions.Default.cs
+++ src/ExternalTemplates.AspNet/IGeneratorOptions.Default.cs
@@ -11,18 +11,18 @@
 		/// Gets the path relative to the web root where the templates are stored.
 		/// Default is "/Content/templates".
 		/// </summary>
-		public string VirtualPath { get; set; }
+		public string VirtualPath { get; set; } = "/Content/templates";

 		/// <summary>
 		/// Gets the extension of the templates.
 		/// Default is ".tmpl.html".
 		/// </summary>
-		public string Extension { get; set; }
+		public string Extension { get; set; } = ".tmpl.html";

 		/// <summary>
 		/// Gets the post string to add to the end of the script tag's id following its name.
 		/// Default is "-tmpl".
 		/// </summary>
-		public string PostString { get; set; }
+		public string PostString { get; set; } = "-tmpl";
 	}
 }


Fix MySql do not support Milliseconds

Fix MySql do not support Milliseconds

--- src/FluentMigrator.Runner/Generators/MySql/MySqlQuoter.cs
+++ src/FluentMigrator.Runner/Generators/MySql/MySqlQuoter.cs
@@ -15,12 +15,11 @@

         public override string FromTimeSpan(System.TimeSpan value)
         {
-            return System.String.Format("{0}{1}:{2}:{3}.{4}{0}"
+            return System.String.Format("{0}{1:00}:{2:00}:{3:00}{0}"
                 , ValueQuote
                 , value.Hours + (value.Days * 24)
                 , value.Minutes
-                , value.Seconds
-                , value.Milliseconds);
+                , value.Seconds);
         }
     }
 }


Rolled version number

Rolled version number

--- src/Html2MarkdownConverter.Web/Properties/AssemblyInfo.cs
+++ src/Html2MarkdownConverter.Web/Properties/AssemblyInfo.cs
@@ -1,5 +1,4 @@
 using System.Reflection;
-using System.Runtime.CompilerServices;
 using System.Runtime.InteropServices;

 // General Information about an assembly is controlled through the following
@@ -31,5 +30,5 @@
 //
 // You can specify all the values or you can default the Revision and Build Numbers
 // by using the '*' as shown below:
-[assembly: AssemblyVersion("1.0.0.*")]
+[assembly: AssemblyVersion("1.0.1.*")]
 //[assembly: AssemblyFileVersion("1.0.0.0")]


Add summary for DefaultFormatter.

Add summary for DefaultFormatter.

--- src/Humanizer/Localisation/Formatters/DefaultFormatter.cs
+++ src/Humanizer/Localisation/Formatters/DefaultFormatter.cs
@@ -86,7 +86,7 @@
         }

         /// <summary>
-        ///
+        /// Formats the specified resource key.
         /// </summary>
         /// <param name="resourceKey">The resource key.</param>
         /// <returns></returns>


readd currency bug

readd currency bug

--- src/NadekoBot/Modules/Searches/Commands/UnitConversion.cs
+++ src/NadekoBot/Modules/Searches/Commands/UnitConversion.cs
@@ -78,12 +78,16 @@
                         UnitType = unitTypeString
                     };
                     uow.ConverterUnits.Add(baseType);
-                    uow.ConverterUnits.AddRange(currencyRates.ConversionRates.Select(u => new ConvertUnit()
+                    Units.Add(baseType);
+                    var range = currencyRates.ConversionRates.Select(u => new ConvertUnit()
                     {
                         InternalTrigger = u.Key,
                         Modifier = u.Value,
                         UnitType = unitTypeString
-                    }).ToArray());
+                    }).ToArray();
+                    uow.ConverterUnits.AddRange(range);
+                    Units.AddRange(range);
+
                     uow.Complete();
                 }
                 _log.Info("Updated Currency");
@@ -132,7 +136,7 @@
                 var targetUnit = Units.Find(x => x.Triggers.Select(y => y.ToLowerInvariant()).Contains(target.ToLowerInvariant()));
                 if (originUnit == null || targetUnit == null)
                 {
-                    await msg.Reply(string.Format("Cannot convert {0} to {1}: units not found", originUnit.Triggers.First(), targetUnit.Triggers.First()));
+                    await msg.Reply(string.Format("Cannot convert {0} to {1}: units not found", origin, target));
                     return;
                 }
                 if (originUnit.UnitType != targetUnit.UnitType)


#873 Adding cancellation checks

#873 Adding cancellation checks

--- src/Nethereum.BlockchainProcessing/BlockchainProcessor.cs
+++ src/Nethereum.BlockchainProcessing/BlockchainProcessor.cs
@@ -37,8 +37,12 @@
                 var progress = await BlockchainProcessingOrchestrator.ProcessAsync(fromBlockNumber, blockToProcess, cancellationToken, _blockProgressRepository).ConfigureAwait(false);
                 if (!progress.HasErrored)
                 {
-                    fromBlockNumber = progress.BlockNumberProcessTo.Value + 1;
-                    await UpdateLastBlockProcessedAsync(progress.BlockNumberProcessTo).ConfigureAwait(false);
+                    if (!cancellationToken.IsCancellationRequested)
+                    {
+                        fromBlockNumber = progress.BlockNumberProcessTo.Value + 1;
+                        await UpdateLastBlockProcessedAsync(progress.BlockNumberProcessTo).ConfigureAwait(false);
+                    }
+                    //else will stop the loop and progress has been updated already on process
                 }
                 else
                 {
@@ -61,8 +65,12 @@
                 var progress = await BlockchainProcessingOrchestrator.ProcessAsync(fromBlockNumber, blockToProcess, cancellationToken, _blockProgressRepository).ConfigureAwait(false);
                 if (!progress.HasErrored)
                 {
-                    fromBlockNumber = progress.BlockNumberProcessTo.Value + 1;
-                    await UpdateLastBlockProcessedAsync(progress.BlockNumberProcessTo).ConfigureAwait(false);
+                    if (!cancellationToken.IsCancellationRequested)
+                    {
+                        fromBlockNumber = progress.BlockNumberProcessTo.Value + 1;
+                        await UpdateLastBlockProcessedAsync(progress.BlockNumberProcessTo).ConfigureAwait(false);
+                    }
+                    //else will stop the loop and progress has been updated already on process
                 }
                 else
                 {


Fix race causing some messages to not be terminated when a silo shuts down, leaving them to timeout instead (#6977)

--- src/Orleans.Runtime/GrainDirectory/LocalGrainDirectory.cs
+++ src/Orleans.Runtime/GrainDirectory/LocalGrainDirectory.cs
@@ -273,25 +273,22 @@
         {
             lock (this.writeLock)
             {
+                try
+                {
+                    // Only notify the catalog once. Order is important: call BEFORE updating membershipRingList.
+                    this.catalogOnSiloRemoved?.Invoke(silo, status);
+                }
+                catch (Exception exc)
+                {
+                    log.Error(ErrorCode.Directory_SiloStatusChangeNotification_Exception,
+                        String.Format("CatalogSiloStatusListener.SiloStatusChangeNotification has thrown an exception when notified about removed silo {0}.", silo.ToStringWithHashCode()), exc);
+                }
+
                 var existing = this.directoryMembership;
                 if (!existing.MembershipCache.Contains(silo))
                 {
                     // we have already removed this silo
                     return;
-                }
-
-                if (this.catalogOnSiloRemoved != null)
-                {
-                    try
-                    {
-                        // Only notify the catalog once. Order is important: call BEFORE updating membershipRingList.
-                        this.catalogOnSiloRemoved(silo, status);
-                    }
-                    catch (Exception exc)
-                    {
-                        log.Error(ErrorCode.Directory_SiloStatusChangeNotification_Exception,
-                            String.Format("CatalogSiloStatusListener.SiloStatusChangeNotification has thrown an exception when notified about removed silo {0}.", silo.ToStringWithHashCode()), exc);
-                    }
                 }

                 // the call order is important


Validate iOS purchases on restore

Validate iOS purchases on restore

--- src/Plugin.InAppBilling.iOS/InAppBillingImplementation.cs
+++ src/Plugin.InAppBilling.iOS/InAppBillingImplementation.cs
@@ -108,10 +108,14 @@
 				.Select(p2 => p2.ToIABPurchase())
 				.Distinct(comparer);

-			//try to validate purchases
-			var valid = await ValidateReceipt(verifyPurchase, string.Empty, string.Empty);
-
-			return valid ? converted : null;
+			var validPurchases = new List<InAppBillingPurchase>();
+			foreach (var purchase in converted)
+			{
+				if (await ValidateReceipt(verifyPurchase, purchase.ProductId, purchase.Id))
+					validPurchases.Add(purchase);
+			}
+
+			return validPurchases.Any() ? validPurchases : null;
 		}


Moved the IF statement to only use the HTML for user menu when someone is logged in

--- src/SFA.DAS.EmployerUsers.Web/Views/Shared/_Layout.cshtml
+++ src/SFA.DAS.EmployerUsers.Web/Views/Shared/_Layout.cshtml
@@ -102,27 +102,28 @@
                     This is a new service – your feedback will help us to improve it.

+            @if (HttpContext.Current.User.Identity.IsAuthenticated)
+            {

                 Settings

-                        @if (HttpContext.Current.User.Identity.IsAuthenticated)
-                        {
-
-                            var identity = (ClaimsIdentity) User?.Identity;
+
+                        @{
+                            var identity = (ClaimsIdentity)User?.Identity;
                             var displayName = identity?.Claims.FirstOrDefault(c => c.Type == DasClaimTypes.DisplayName)?.Value ?? "";
-
+                        }

                                 @displayName

Log out

-                        }
+

-

+            }


Warning suppressed.

Warning suppressed.

--- NChannels/Select.cs
+++ NChannels/Select.cs
@@ -156,7 +156,9 @@

 			if (_immediateSelections.Count > 0)
 			{
+#pragma warning disable 4014
 				Task.Delay(1).ContinueWith(_ => MakeRandomSelection());
+#pragma warning restore 4014
 			}

 			await (await _selection.Task)();


Small refactor in BaseParserTests

Small refactor in BaseParserTests

That I didn't need after all, but I left in :)

--- src/Tests/Nest.Tests.Unit/QueryParsers/BaseParserTests.cs
+++ src/Tests/Nest.Tests.Unit/QueryParsers/BaseParserTests.cs
@@ -13,18 +13,15 @@
 	{
 		public ISearchRequest GetSearchDescriptorForQuery(Func<SearchDescriptor<ElasticsearchProject>, SearchDescriptor<ElasticsearchProject>> create)
 		{
-			var descriptor = create(new SearchDescriptor<ElasticsearchProject>());
-			var json = this._client.Serializer.Serialize(descriptor);
-			Console.WriteLine(json.Utf8String());
-			using (var ms = new MemoryStream(json))
-			{
-				ISearchRequest d = this._client.Serializer.Deserialize<SearchDescriptor<ElasticsearchProject>>(ms);
-				d.Should().NotBeNull();
-				d.Query.Should().NotBeNull();
-				return d;
-			}
+			return GetSearchDescriptor(create, request => request.Query.Should().NotBeNull());
 		}
+
 		public ISearchRequest GetSearchDescriptorForFilter(Func<SearchDescriptor<ElasticsearchProject>, SearchDescriptor<ElasticsearchProject>> create)
+		{
+			return GetSearchDescriptor(create, request => request.Filter.Should().NotBeNull());
+		}
+
+		private ISearchRequest GetSearchDescriptor(Func<SearchDescriptor<ElasticsearchProject>, SearchDescriptor<ElasticsearchProject>> create, Action<ISearchRequest> assertFunc )
 		{
 			var descriptor = create(new SearchDescriptor<ElasticsearchProject>());
 			var json = this._client.Serializer.Serialize(descriptor);
@@ -33,7 +30,7 @@
 			{
 				ISearchRequest d = this._client.Serializer.Deserialize<SearchDescriptor<ElasticsearchProject>>(ms);
 				d.Should().NotBeNull();
-				d.Filter.Should().NotBeNull();
+				assertFunc(d);
 				return d;
 			}
 		}


Update Tests.cs

Update Tests.cs

--- NUnitTests/Tests.cs
+++ NUnitTests/Tests.cs
@@ -16,8 +16,8 @@
             if (res.Equals(ResultState.Failure) || res.Equals(ResultState.Error))
             {
                 //ScreenHelper.SaveScreenshot(TakeScreen());
-                var bytes = TakeScreen();
-                var fullPath = SaveScreen(bytes, Guid.NewGuid() + ".png");
+                var bytes = TestBase.TakeScreen();
+                var fullPath = TestBase.SaveScreen(bytes, Guid.NewGuid() + ".png");
                 TestContext.AddTestAttachment(fullPath);
             }
         }
@@ -34,7 +34,7 @@
         public void TestMethodFailed()
         {
             Console.WriteLine("Taking screen...");
-            var bytes = TakeScreen();
+            var bytes = TestBase.TakeScreen();
             //all you need to do is to pass byte[] to ScreenHelper:
             ScreenHelper.SaveScreenshot(bytes);
             Console.WriteLine("Done.");
@@ -46,10 +46,10 @@
         public void TestMethod()
         {
             Console.WriteLine("Taking screen...");
-            var bytes = TakeScreen();
-            var fullPath1 = SaveScreen(bytes, Guid.NewGuid() + ".png");
-            var fullPath2 = SaveScreen(bytes, Guid.NewGuid() + ".png");
-            var fullPath3 = SaveScreen(bytes, Guid.NewGuid() + ".png");
+            var bytes = TestBase.TakeScreen();
+            var fullPath1 = TestBase.SaveScreen(bytes, Guid.NewGuid() + ".png");
+            var fullPath2 = TestBase.SaveScreen(bytes, Guid.NewGuid() + ".png");
+            var fullPath3 = TestBase.SaveScreen(bytes, Guid.NewGuid() + ".png");
             //all you need to do is to add full path to TestContext:
             TestContext.AddTestAttachment(fullPath1);
             TestContext.AddTestAttachment(fullPath2);
@@ -74,49 +74,5 @@
             TestContext.AddTestAttachment(Path.GetTempFileName());
             Assert.AreEqual(1, 1);
         }
-
-        public static byte[] TakeScreen()
-        {
-            return Convert.FromBase64String(@"iVBORw0KGgoAAAANSUhEUgAAAC4AAAAsCAIAAACVEx1rAAAAAXNSR0IArs4c6QAAAARnQU1BAACx
-jwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAASdEVYdFNvZnR3YXJlAEdyZWVuc2hvdF5VCAUA
-AAZQSURBVFhH1Zj5U1NXFMf7Lxa7uHSqzvQHnWlnbH9w2h+so/UHO21BhJbW0gVbtbVCFavjlggJ
-gSRsAoEkZIMEwpJ9IyEb/ST38fJ4SSARy9jv3B/uds75vnvPOffe98bWa4P/LZVCoZDNZuPxuM/n
-m5mZMZlMOp1OUwYVmnR6vV4mMK1YLEpijaFRKvl8PhKJeDyesbGx58+fC/P1wASmMRkRBCUVe2Fv
-KnwcX2mz2YaHhyVTDQMRBBFvZIX2prKysmIwGLRaraS+SSCIOEokdfWxGxX2m2+SVG7jqebxI+29
-Pm13z8C5rsFTV3RHvtG3UNp1R2jSyRATmCYJbANVKJRU10JdKhsbGxaLRbkYaL+n7bk+cKFDd6Js
-/s06pYUJTLur7VESQhUKUSsZqEJtKtBHTOmeDzW9PQOfd+iOVxmuWzp07yOCoKSi7M6orbc2tamw
-mMr16NfeYPFb9YdUxvYsiHQNnkZcUlReG5RLZnZCTQVX9/v9klwZ97U3O0s7ojbTeEEcJZK6MvDi
-6phSUyHwcHhJorwe++QhCkqUa4MJDEkmt7GDCulIuTVsM/uiUvrSBVWy34htUmW/HVRIjnIew/lx
-upfwj3oFVSiUYwpD0WhUMlxGhQqbt7CwIOYBQrE6Xn4aPf37i7Pdo6dah16GIgpRKxnQaDCn9JgK
-FWKMg0NMgjuJQaWI4giOMNO6rusYPqoaarCgVl4YzCkDu0IFP5ITCemynMfUivZPBbUoF1YGBgaU
-zluhwrkvZgCSd818un8qqEW5ZEajwaiwDipUuGqwKpOTk8FgMJ1NrcTnH9hanzi+dYXMRu9f3xlL
-fiOo2AOGXssXnvB4cjO8Enc8tLVdGXpbWJryP3KGTFpXd//cl0sxa2ozuhCe7J250Db0FqOdI+8N
-e/9YDjrtdrvb7U6n05lMRlgHFSpcfKanpxmmHs8E15OeRCYYSC3QXIxMXTN/IFOJZQLJzchawhVN
-rxaLhUKx8MDWJqgEU77iVjGWXo+m10IpH3qYn8pG+ucuM9plOskHlHpSKSJZXMRoClSoEF2sB5Vk
-Mtk7ffG3iU8G3b9u5kunl4pKNp/ROruvT5zBQCC1SI8nPClToZnJpYzeOzdfnP179tJyzEoPtK4Y
-3pGpQIKt4TyyWkujAhUqZMBcLkdlbm5OOArCfDo9KipLsdmu8n51jhxzBI30BFNeJRVf1ELA02zV
-tzye78wX+PTijRdnZSrsi16vx1dwCZoCOzZIVEZHR2Wfta7r6VFRsa/rO4eP0Ww3HLYHhugJp/1i
-vqCCM7UPHxY9vZaL7Cad/1i/lqkQOMJtSbs0BSpUYCASDp5bvhCVFAlJFRU5gqBiK1OJ7KTCUuGh
-oqfPcimVjdF5b+6yTCUcDgsqXM5pClSowED47PLysjh6esbPxDMBepqlspZ0X5/4mGbb0CGN81q+
-kOMjfx7/SKYSCoUEFXkrQIUKLrK0tEQFn3Ksm0cW/1xNuAgQepqlUijm54Mjt6Y+Y1Mi6dKt1h+3
-c1ZUU8FzaQpUqPB+MZvNHFFQoYmvrSXca0kP9WappHMJUg5RTZ2PYWnxWUarqdROcYlEgp0zGo0u
-l8u3vGj29P8y9qEzZGbIE5743nQSXVrnj5ZV7VNHV7vhXZpktmfOH+gx+/qUVBxB033rV7NrA+7Q
-+PTK09vT58TxScQZXLeX/T6HwwEPwqd24mcxAoEAVzjy4DPtE86tq4aj7BFDhMnV7YjYvQgqRBDz
-WbMu4wlBWi4NHYcy4ESucy7NLkWt+WIuV9gcdPco1e1SlFRUQxQuCbwZBA/A81E4g8AOKiRjkg+J
-TmTlfD63kY2XPaOURRop/pg9nYtbVjVXDWoq5avT+YauTgAG7A4nEbe9+fn5WevM3cnWpm5Jt6Y+
-vTNznjOhWoqr/0NNn+BBZuNE3O1CCfCjA7hmsyREiWRyG2oq5KKDeXxI9hSo4bag1pPs9EE/yQSI
-sVoP1fNNPlSPI7Lfhyqo/3y/eKDPdwHos5iSpm2gXflTo13HCQCtFio0eem8+p8aMl7Jrx5CQVJX
-H3tTAQQeaUB+ODYORFiM6ritiYaoANIRyZH3HAcH7xfJVB3gnuK3ICKqPLYLGqUiQNZhv0mD4pJc
-/bOUToaYwDTl+dIImqPyn+K1obK19S+Y9iFAnNq8+AAAAABJRU5ErkJggg==");
-        }
-
-        public static string SaveScreen(byte[] screen, string fileName)
-        {
-            var folder = @"C:\Screenshots";
-            Directory.CreateDirectory(folder);
-            var fullPath = Path.Combine(folder, fileName);
-            File.WriteAllBytes(fullPath, screen);
-            return fullPath;
-        }
     }
 }


make HttpResponse#EnableCompression property functional

HttpResponse now takes in to account the value of the EnableCompression property.

--- Net/HttpResponse.cs
+++ Net/HttpResponse.cs
@@ -372,7 +372,11 @@
                 {
                     // If we've got a request object available to us,
                     // we can check whether the client supports compression.
-                    if (this.Request != null)
+                    //
+                    // We also need to check whether the programmer has enabled
+                    // compression. If compression is not enabled, we must not
+                    // compress the output. Compression is enabled by default.
+                    if (this.Request != null && this.EnableCompression)
                     {
                         var hdr = this.Request.Headers[HDR_ACCEPTENCODING]
                             .DefaultIfEmpty(null)


fix an infinite recursion in HttpResponse#WriteLine

--- Net/HttpResponse.cs
+++ Net/HttpResponse.cs
@@ -753,9 +753,9 @@
         ///     sent, or when it is called after the connection has been
         ///     closed.
         /// </exception>
-        public void Write(object value)
-        {
-            this.Write(value: value.ToString());
+        public void Write(object obj)
+        {
+            this.Write(value: obj.ToString());
         }
         /// <summary>
         /// Writes the provided string to the response.
@@ -773,20 +773,20 @@
         /// <summary>
         /// Writes the provided bytes to the response.
         /// </summary>
-        /// <param name="value">The value to write to the response.</param>
+        /// <param name="bytes">The value to write to the response.</param>
         /// <exception cref="System.InvalidOperationException">
         ///     Thrown when the method is called after the headers or
         ///     sent, or when it is called after the connection has been
         ///     closed.
         /// </exception>
-        public void Write(IEnumerable<byte> value)
+        public void Write(IEnumerable<byte> bytes)
         {
             // Ensure that the response has not been closed.
             CheckClosed();
             // Send headers if necessary.
             _ConditionalSendHeaders();

-            _Write(value is byte[] ? (byte[])value : value.ToArray());
+            _Write(bytes is byte[] ? (byte[])bytes : bytes.ToArray());
         }
         /// <summary>
         /// Writes the provided values to the response in the
@@ -813,9 +813,9 @@
         ///     sent, or when it is called after the connection has been
         ///     closed.
         /// </exception>
-        public void WriteLine(object value)
-        {
-            this.Write(value: String.Format("{0}{1}", value.ToString(), HTTP_NEWLINE));
+        public void WriteLine(object obj)
+        {
+            this.Write("{0}{1}", obj.ToString(), HTTP_NEWLINE);
         }
         /// <summary>
         /// Writes the provided string to the response,
@@ -829,7 +829,7 @@
         /// </exception>
         public void WriteLine(string value)
         {
-            this.WriteLine(value: String.Format("{0}{1}", value, HTTP_NEWLINE));
+            this.Write("{0}{1}", value, HTTP_NEWLINE);
         }
         /// <summary>
         /// Writes the provided values to the response in the


Add additional null conditionals as this method is sometimes called for front end rendering where this is no current user (DTGE)

--- src/Umbraco.Web/PropertyEditors/RichTextPropertyEditor.cs
+++ src/Umbraco.Web/PropertyEditors/RichTextPropertyEditor.cs
@@ -114,7 +114,7 @@
                 if (editorValue.Value == null)
                     return null;

-                var userId = _umbracoContextAccessor.UmbracoContext?.Security.CurrentUser.Id ?? Constants.Security.SuperUserId;
+                var userId = _umbracoContextAccessor.UmbracoContext?.Security?.CurrentUser?.Id ?? Constants.Security.SuperUserId;

                 var config = editorValue.DataTypeConfiguration as RichTextConfiguration;
                 var mediaParent = config?.MediaParentId;


Patching from constr to factory is good

Patching from constr to factory is good

--- NetInject/Purger.cs
+++ NetInject/Purger.cs
@@ -242,11 +242,8 @@
             {
                 foreach (var field in type.Fields)
                 {
-                    var fieldAss = field.FieldType.Scope as AssemblyNameReference;
-                    if (fieldAss == null)
-                        continue;
-                    AssemblyDefinition genAss;
-                    if (!gens.TryGetValue($"{fieldAss.Name}{apiSuffix}", out genAss))
+                    var genAss = FindGenerated(field.FieldType, gens);
+                    if (genAss == null)
                         continue;
                     var newType = genAss.GetAllTypes().FirstOrDefault(
                         t => t.Namespace == $"{apiPrefix}{field.FieldType.Namespace}"
@@ -255,9 +252,42 @@
                 }
                 foreach (var meth in type.Methods)
                 {
-                    // TODO: newobj in static call to factory ?!
-                }
-            }
+                    var ils = meth.Body.GetILProcessor();
+                    foreach (var il in meth.Body.Instructions.ToArray())
+                    {
+                        var opMethDef = il.Operand as MethodDefinition;
+                        var opMethRef = il.Operand as MethodReference;
+                        if (opMethDef == null && opMethRef == null)
+                            continue;
+                        var methType = opMethDef?.DeclaringType ?? opMethRef.DeclaringType;
+                        var genAss = FindGenerated(methType, gens);
+                        if (genAss == null)
+                            continue;
+                        if (il.OpCode == OpCodes.Newobj)
+                        {
+                            var newType = genAss.GetAllTypes().FirstOrDefault(
+                                t => t.Namespace == $"{apiPrefix}{methType.Namespace}"
+                                && t.Name == $"I{methType.Name}Factory");
+                            var newMeth = newType.Methods.FirstOrDefault(m => m.Name == $"Create{methType.Name}");
+                            if (newMeth == null)
+                                continue;
+                            log.Info($"   ::> '{newMeth}'");
+                            ils.Replace(il, ils.Create(OpCodes.Callvirt, type.Module.ImportReference(newMeth)));
+                        }
+                    }
+                }
+            }
+        }
+
+        static AssemblyDefinition FindGenerated(TypeReference origType, IDictionary<string, AssemblyDefinition> gens)
+        {
+            var origAss = origType.Scope as AssemblyNameReference;
+            if (origAss == null)
+                return null;
+            AssemblyDefinition genAss;
+            if (!gens.TryGetValue($"{origAss.Name}{apiSuffix}", out genAss))
+                return null;
+            return genAss;
         }
     }
 }


Fixes: U4-5384 Custom ApiController routes not working after upgrade to 7.1.5

--- src/Umbraco.Web/WebApi/NamespaceHttpControllerSelector.cs
+++ src/Umbraco.Web/WebApi/NamespaceHttpControllerSelector.cs
@@ -25,7 +25,10 @@
         public override HttpControllerDescriptor SelectController(HttpRequestMessage request)
         {
             var routeData = request.GetRouteData();
-            if (routeData == null || routeData.Route == null || routeData.Route.DataTokens["Namespaces"] == null)
+            if (routeData == null
+                || routeData.Route == null
+                || routeData.Route.DataTokens == null
+                || routeData.Route.DataTokens["Namespaces"] == null)
                 return base.SelectController(request);

             // Look up controller in route data


add simple instance identification to debugmon

--- Nouzuru/DebugMon.cs
+++ Nouzuru/DebugMon.cs
@@ -155,6 +155,12 @@
         /// </summary>
         public bool InitialBreakpointHit { get; private set; }

+        /// <summary>
+        /// Gets or sets an identifier that is appended to log entriess. This can be used to identify which instance
+        /// of a debugger caused an event or exception.
+        /// </summary>
+        public string InstanceIdentifier { get; set; }
+
         #endregion

         #region Methods
@@ -172,7 +178,8 @@
             {
                 string imageName = Auxiliary.GetFileNameFromHandle(de.CreateProcessInfo.hFile);
                 uint pid = WinApi.GetProcessId(de.CreateProcessInfo.hProcess);
-                this.monitorLogger.Log("Process created: " + imageName + " (PID: " + pid + ")");
+                this.monitorLogger.Log(
+                    "Process created: " + imageName + " (PID: " + pid + ") (" + this.InstanceIdentifier + ")");
             }

             return base.OnCreateProcessDebugEvent(ref de);
@@ -187,7 +194,7 @@
         {
             if (this.EventsMonitored.HasFlag(EventFilter.CREATE_THREAD_DEBUG_EVENT))
             {
-                this.monitorLogger.Log("OnCreateThreadDebugEvent called.");
+                this.monitorLogger.Log("OnCreateThreadDebugEvent called. (" + this.InstanceIdentifier + ")");
             }

             return base.OnCreateThreadDebugEvent(ref de);
@@ -202,7 +209,7 @@
         {
             if (this.EventsMonitored.HasFlag(EventFilter.EXIT_PROCESS_DEBUG_EVENT))
             {
-                this.monitorLogger.Log("OnExitProcessDebugEvent called.");
+                this.monitorLogger.Log("OnExitProcessDebugEvent called. (" + this.InstanceIdentifier + ")");
             }

             return base.OnExitProcessDebugEvent(ref de);
@@ -217,7 +224,7 @@
         {
             if (this.EventsMonitored.HasFlag(EventFilter.EXIT_THREAD_DEBUG_EVENT))
             {
-                this.monitorLogger.Log("OnExitThreadDebugEvent called.");
+                this.monitorLogger.Log("OnExitThreadDebugEvent called. (" + this.InstanceIdentifier + ")");
             }

             return base.OnExitThreadDebugEvent(ref de);
@@ -233,7 +240,7 @@
             if (this.EventsMonitored.HasFlag(EventFilter.LOAD_DLL_DEBUG_EVENT))
             {
                 string dllName = Auxiliary.GetFileNameFromHandle(de.LoadDll.hFile);
-                this.monitorLogger.Log("DLL loaded: " + dllName);
+                this.monitorLogger.Log("DLL loaded: " + dllName + " (" + this.InstanceIdentifier + ")");
             }

             return base.OnLoadDllDebugEvent(ref de);
@@ -248,7 +255,7 @@
         {
             if (this.EventsMonitored.HasFlag(EventFilter.OUTPUT_DEBUG_STRING_EVENT))
             {
-                this.monitorLogger.Log("OnOutputDebugStringEvent called.");
+                this.monitorLogger.Log("OnOutputDebugStringEvent called. (" + this.InstanceIdentifier + ")");
             }

             return base.OnOutputDebugStringEvent(ref de);
@@ -263,7 +270,7 @@
         {
             if (this.EventsMonitored.HasFlag(EventFilter.RIP_EVENT))
             {
-                this.monitorLogger.Log("OnRipEvent called.");
+                this.monitorLogger.Log("OnRipEvent called. (" + this.InstanceIdentifier + ")");
             }

             return base.OnRipEvent(ref de);
@@ -279,7 +286,7 @@
             if (this.EventsMonitored.HasFlag(EventFilter.UNLOAD_DLL_DEBUG_EVENT))
             {
                 string dllName = Auxiliary.GetFileNameFromHModule(de.UnloadDll.lpBaseOfDll);
-                this.monitorLogger.Log("DLL unloaded: " + dllName);
+                this.monitorLogger.Log("DLL unloaded: " + dllName + " (" + this.InstanceIdentifier + ")");
             }

             return base.OnUnloadDllDebugEvent(ref de);
@@ -298,7 +305,7 @@
         {
             if (this.ExceptionsMonitored.HasFlag(ExceptionFilter.ACCESS_VIOLATION))
             {
-                this.monitorLogger.Log("OnAccessViolationDebugException called.");
+                this.monitorLogger.Log("OnAccessViolationDebugException called. (" + this.InstanceIdentifier + ")");
             }

             return base.OnAccessViolationDebugException(ref de);
@@ -313,7 +320,7 @@
         {
             if (this.ExceptionsMonitored.HasFlag(ExceptionFilter.ARRAY_BOUNDS_EXCEEDED))
             {
-                this.monitorLogger.Log("OnArrayBoundsExceededDebugException called.");
+                this.monitorLogger.Log("OnArrayBoundsExceededDebugException called. (" + this.InstanceIdentifier + ")");
             }

             return base.OnArrayBoundsExceededDebugException(ref de);
@@ -354,7 +361,7 @@
         {
             if (this.ExceptionsMonitored.HasFlag(ExceptionFilter.DATATYPE_MISALIGNMENT))
             {
-                this.monitorLogger.Log("OnDatatypeMisalignmentDebugException called.");
+                this.monitorLogger.Log("OnDatatypeMisalignmentDebugException called. (" + this.InstanceIdentifier + ")");
             }

             return base.OnDatatypeMisalignmentDebugException(ref de);
@@ -369,7 +376,7 @@
         {
             if (this.ExceptionsMonitored.HasFlag(ExceptionFilter.FLT_DENORMAL_OPERAND))
             {
-                this.monitorLogger.Log("OnFltDenormalOperandDebugException called.");
+                this.monitorLogger.Log("OnFltDenormalOperandDebugException called. (" + this.InstanceIdentifier + ")");
             }

             return base.OnFltDenormalOperandDebugException(ref de);
@@ -384,7 +391,7 @@
         {
             if (this.ExceptionsMonitored.HasFlag(ExceptionFilter.FLT_DIVIDE_BY_ZERO))
             {
-                this.monitorLogger.Log("OnFltDivideByZeroDebugException called.");
+                this.monitorLogger.Log("OnFltDivideByZeroDebugException called. (" + this.InstanceIdentifier + ")");
             }

             return base.OnFltDivideByZeroDebugException(ref de);
@@ -399,7 +406,7 @@
         {
             if (this.ExceptionsMonitored.HasFlag(ExceptionFilter.FLT_INEXACT_RESULT))
             {
-                this.monitorLogger.Log("OnFltInexactResultDebugException called.");
+                this.monitorLogger.Log("OnFltInexactResultDebugException called. (" + this.InstanceIdentifier + ")");
             }

             return base.OnFltInexactResultDebugException(ref de);
@@ -414,7 +421,7 @@
         {
             if (this.ExceptionsMonitored.HasFlag(ExceptionFilter.FLT_INVALID_OPERATION))
             {
-                this.monitorLogger.Log("OnFltInvalidOperationDebugException called.");
+                this.monitorLogger.Log("OnFltInvalidOperationDebugException called. (" + this.InstanceIdentifier + ")");
             }

             return base.OnFltInvalidOperationDebugException(ref de);
@@ -429,7 +436,7 @@
         {
             if (this.ExceptionsMonitored.HasFlag(ExceptionFilter.FLT_OVERFLOW))
             {
-                this.monitorLogger.Log("OnFltOverflowDebugException called.");
+                this.monitorLogger.Log("OnFltOverflowDebugException called. (" + this.InstanceIdentifier + ")");
             }

             return base.OnFltOverflowDebugException(ref de);
@@ -444,7 +451,7 @@
         {
             if (this.ExceptionsMonitored.HasFlag(ExceptionFilter.FLT_STACK_CHECK))
             {
-                this.monitorLogger.Log("OnFltStackCheckDebugException called.");
+                this.monitorLogger.Log("OnFltStackCheckDebugException called. (" + this.InstanceIdentifier + ")");
             }

             return base.OnFltStackCheckDebugException(ref de);
@@ -459,7 +466,7 @@
         {
             if (this.ExceptionsMonitored.HasFlag(ExceptionFilter.FLT_UNDERFLOW))
             {
-                this.monitorLogger.Log("OnFltUnderflowDebugException called.");
+                this.monitorLogger.Log("OnFltUnderflowDebugException called. (" + this.InstanceIdentifier + ")");
             }

             return base.OnFltUnderflowDebugException(ref de);
@@ -474,7 +481,7 @@
         {
             if (this.ExceptionsMonitored.HasFlag(ExceptionFilter.GUARD_PAGE))
             {
-                this.monitorLogger.Log("OnGuardPageDebugException called.");
+                this.monitorLogger.Log("OnGuardPageDebugException called. (" + this.InstanceIdentifier + ")");
             }

             return base.OnGuardPageDebugException(ref de);
@@ -489,7 +496,7 @@
         {
             if (this.ExceptionsMonitored.HasFlag(ExceptionFilter.ILLEGAL_INSTRUCTION))
             {
-                this.monitorLogger.Log("OnIllegalInstructionDebugException called.");
+                this.monitorLogger.Log("OnIllegalInstructionDebugException called. (" + this.InstanceIdentifier + ")");
             }

             return base.OnIllegalInstructionDebugException(ref de);
@@ -504,7 +511,7 @@
         {
             if (this.ExceptionsMonitored.HasFlag(ExceptionFilter.IN_PAGE_ERROR))
             {
-                this.monitorLogger.Log("OnInPageErrorDebugException called.");
+                this.monitorLogger.Log("OnInPageErrorDebugException called. (" + this.InstanceIdentifier + ")");
             }

             return base.OnInPageErrorDebugException(ref de);
@@ -519,7 +526,7 @@
         {
             if (this.ExceptionsMonitored.HasFlag(ExceptionFilter.INT_DIVIDE_BY_ZERO))
             {
-                this.monitorLogger.Log("OnIntDivideByZeroDebugException called.");
+                this.monitorLogger.Log("OnIntDivideByZeroDebugException called. (" + this.InstanceIdentifier + ")");
             }

             return base.OnIntDivideByZeroDebugException(ref de);
@@ -534,7 +541,7 @@
         {
             if (this.ExceptionsMonitored.HasFlag(ExceptionFilter.INT_OVERFLOW))
             {
-                this.monitorLogger.Log("OnIntOverflowDebugException called.");
+                this.monitorLogger.Log("OnIntOverflowDebugException called. (" + this.InstanceIdentifier + ")");
             }

             return base.OnIntOverflowDebugException(ref de);
@@ -549,7 +556,7 @@
         {
             if (this.ExceptionsMonitored.HasFlag(ExceptionFilter.INVALID_DISPOSITION))
             {
-                this.monitorLogger.Log("OnInvalidDispositionDebugException called.");
+                this.monitorLogger.Log("OnInvalidDispositionDebugException called. (" + this.InstanceIdentifier + ")");
             }

             return base.OnInvalidDispositionDebugException(ref de);
@@ -564,7 +571,7 @@
         {
             if (this.ExceptionsMonitored.HasFlag(ExceptionFilter.NONCONTINUABLE_EXCEPTION))
             {
-                this.monitorLogger.Log("OnNoncontinuableExceptionDebugException called.");
+                this.monitorLogger.Log("OnNoncontinuableExceptionDebugException called. (" + this.InstanceIdentifier + ")");
             }

             return base.OnNoncontinuableExceptionDebugException(ref de);
@@ -579,7 +586,7 @@
         {
             if (this.ExceptionsMonitored.HasFlag(ExceptionFilter.PRIV_INSTRUCTION))
             {
-                this.monitorLogger.Log("OnPrivInstructionDebugException called.");
+                this.monitorLogger.Log("OnPrivInstructionDebugException called. (" + this.InstanceIdentifier + ")");
             }

             return base.OnPrivInstructionDebugException(ref de);
@@ -594,7 +601,7 @@
         {
             if (this.ExceptionsMonitored.HasFlag(ExceptionFilter.SINGLE_STEP))
             {
-                this.monitorLogger.Log("OnSingleStepDebugException called.");
+                this.monitorLogger.Log("OnSingleStepDebugException called. (" + this.InstanceIdentifier + ")");
             }

             return base.OnSingleStepDebugException(ref de);
@@ -609,7 +616,7 @@
         {
             if (this.ExceptionsMonitored.HasFlag(ExceptionFilter.STACK_OVERFLOW))
             {
-                this.monitorLogger.Log("OnStackOverflowDebugException called.");
+                this.monitorLogger.Log("OnStackOverflowDebugException called. (" + this.InstanceIdentifier + ")");
             }

             return base.OnStackOverflowDebugException(ref de);


Rename variable to 'setting'.

Rename variable to 'setting'.

--- src/VisualStudio/PackageSource/VSPackageSourceProvider.cs
+++ src/VisualStudio/PackageSource/VSPackageSourceProvider.cs
@@ -208,13 +208,13 @@

             PackageSource packageSource;
             if (settingValues != null && settingValues.Any()) {
-                KeyValuePair<string, string> pair = settingValues.First();
+                KeyValuePair<string, string> setting = settingValues.First();
                 // if the active source is the Aggregate source, we persist it as <add key="All" value="(Aggregate source)" />
-                if (AggregateSourceInstance.Name.Equals(pair.Key, StringComparison.CurrentCultureIgnoreCase)) {
+                if (AggregateSourceInstance.Name.Equals(setting.Key, StringComparison.CurrentCultureIgnoreCase)) {
                     packageSource = AggregateSourceInstance;
                 }
                 else {
-                    packageSource = new PackageSource(pair.Value, pair.Key);
+                    packageSource = new PackageSource(setting.Value, setting.Key);
                 }
             }
             else {


Fix namespace mistake.

Fix namespace mistake.

--- src/VisualStudio/ProductUpdate/VsProductUpdateSettings.cs
+++ src/VisualStudio/ProductUpdate/VsProductUpdateSettings.cs
@@ -1,9 +1,8 @@
 using System;
 using System.ComponentModel.Composition;

-namespace NuGet.VisualStudio.ProductUpdate
+namespace NuGet.VisualStudio
 {
-
     [Export(typeof(IProductUpdateSettings))]
     public class VsProductUpdateSettings : SettingsManagerBase, IProductUpdateSettings
     {


1.0.1.9


Second work towards tunnel mode.

Second work towards tunnel mode.

Signed-off-by: V10lator <fd1911a80a45064cec08d87c592168c9000a1489@myway.de>

--- PlayerController.cs
+++ PlayerController.cs
@@ -11,6 +11,8 @@

 		private Vector3 moveDirection = Vector3.zero;
 		private CharacterController controller;
+
+		private bool underground = false;

 		// Use this for initialization
 		void Start()
@@ -32,7 +34,8 @@

 			// Detect tunnels
 			bool grounded;
-			if (controller.isGrounded)
+			controller.detectCollisions = true;
+			if (controller.isGrounded || underground)
 			{
 				Block block = GameController.Instance.park.blockData.getBlock(transform.position);
 				if (block != null && block is Path)
@@ -40,32 +43,52 @@
 					Path path = (Path)block;
 					if (path.isUnderground())
 					{
+						if (!underground)
+						{
+							underground = true;
+							UltimateMain.Instance.Log("Entering tunnel", UltimateMain.LogLevel.INFO);
+						}
 						float top = block.getTopSideY(transform.position) + UltimateMain.Instance.config.Height;
-						UltimateMain.Instance.Log("V10DBG1: " + top + " vs. " + transform.position.y, UltimateMain.LogLevel.INFO);
 						// Tunnel down
 						if (top < transform.position.y)
+							transform.position = new Vector3(transform.position.x, top, transform.position.z);
+						// We somehow felt into the ground (tunnel up?) - fixing...
+						else if (top > transform.position.y)
 						{
-							UltimateMain.Instance.Log("V10DBG: " + top, UltimateMain.LogLevel.INFO);
+							UltimateMain.Instance.Log("V10DBG: Fixig FTG", UltimateMain.LogLevel.INFO);
 							transform.position = new Vector3(transform.position.x, top, transform.position.z);
-							grounded = true;
-						}
-						// We somehow fall into the ground - fix...
-						else if (transform.position.y - top < 0.05f)
+						}
+						grounded = true;
+					}
+					else
+					{
+						if (underground)
 						{
-							transform.position = new Vector3(transform.position.x, top, transform.position.z);
-							grounded = true;
-						}
-						else
-							grounded = false;
-					}
-					else
+							UltimateMain.Instance.Log("V10DBG: Else 2 / End of tunnel", UltimateMain.LogLevel.INFO);
+							underground = false;
+						}
 						grounded = true;
+					}
 				}
 				else
+				{
+					if (underground)
+					{
+						UltimateMain.Instance.Log("V10DBG: Else 3 / End of tunnel", UltimateMain.LogLevel.INFO);
+						underground = false;
+					}
 					grounded = true;
+				}
 			}
 			else
+			{
+				if (underground)
+				{
+					UltimateMain.Instance.Log("V10DBG: Else 4 / End of tunnel", UltimateMain.LogLevel.INFO);
+					underground = false;
+				}
 				grounded = false;
+			}

 			bool falling;
 			if (grounded || UltimateMain.Instance.config.Jetpack)


remove extra space

remove extra space

--- Pluton/IniParser.cs
+++ Pluton/IniParser.cs
@@ -157,7 +157,7 @@

         public string[] EnumSection(string section)
         {
-            return Sections.ContainsKey(section) ? Sections[section].Settings.Keys.ToArray() : new string[0] ;
+            return Sections.ContainsKey(section) ? Sections[section].Settings.Keys.ToArray() : new string[0];
         }

         public string GetSetting(string section, string setting)


v1.3.1 * Further refactored player code

v1.3.1
* Further refactored player code

--- TheLunaticPlayer.cs
+++ TheLunaticPlayer.cs
@@ -1,4 +1,5 @@
 using HamstarHelpers.Helpers.DebugHelpers;
+using HamstarHelpers.Helpers.PlayerHelpers;
 using Microsoft.Xna.Framework.Graphics;
 using PlayerExtend;
 using System;
@@ -51,26 +52,71 @@

 		////////////////

-		public override void OnEnterWorld( Player player ) {    // This seems to be as close to a constructor as we're gonna get!
+		public override void SyncPlayer( int to_who, int from_who, bool new_player ) {
+			var mymod = (TheLunaticMod)this.mod;
+
+			if( Main.netMode == 2 ) {
+				if( to_who == -1 && from_who == this.player.whoAmI ) {
+					this.OnServerConnect();
+				}
+			}
+		}
+
+		public override void OnEnterWorld( Player player ) {
+			if( player.whoAmI != this.player.whoAmI ) { return; }
+
+			var mymod = (TheLunaticMod)this.mod;
+
+			if( Main.netMode == 0 ) {
+				if( !mymod.ConfigJson.LoadFile() ) {
+					mymod.ConfigJson.SaveFile();
+					ErrorLogger.Log( "Lunatic config " + LunaticConfigData.ConfigVersion.ToString() + " created (ModPlayer.OnEnterWorld())." );
+				}
+			}
+
+			if( mymod.Config.DebugModeInfo ) {
+				bool _;
+				ErrorLogger.Log( "TheLunatic.TheLunaticPlayer.OnEnterWorld - " + player.name + " joined (" + PlayerIdentityHelpers.GetUniqueId( player, out _ ) + ")" );
+			}
+
+			if( Main.netMode == 0 ) {
+				this.OnSingleConnect();
+			}
+			if( Main.netMode == 1 ) {
+				this.OnClientConnect();
+			}
+		}
+
+		private void OnSingleConnect() {
 			if( player.whoAmI == this.player.whoAmI ) {    // Current player
 				var mymod = (TheLunaticMod)this.mod;
-				var modworld = mymod.GetModWorld<TheLunaticWorld>();
-
-				if( Main.netMode != 2 ) {   // Not server
-					if( !mymod.ConfigJson.LoadFile() ) {
-						mymod.ConfigJson.SaveFile();
-					}
-				}
-				modworld.GameLogic.ApplyDebugOverrides( mymod );
-
-				if( Main.netMode == 1 ) {	// Client
-					ClientPacketHandlers.SendRequestModSettingsFromClient( mymod );
-					ClientPacketHandlers.SendRequestModDataFromClient( mymod );
-				} else if( Main.netMode == 0 ) {	// Single
-					this.PostEnterWorld();
-				}
-			}
-		}
+				var myworld = mymod.GetModWorld<TheLunaticWorld>();
+
+				myworld.GameLogic.ApplyDebugOverrides( mymod );
+
+				this.PostEnterWorld();
+			}
+		}
+		private void OnClientConnect() {
+			if( player.whoAmI == this.player.whoAmI ) {    // Current player
+				var mymod = (TheLunaticMod)this.mod;
+				var myworld = mymod.GetModWorld<TheLunaticWorld>();
+
+				myworld.GameLogic.ApplyDebugOverrides( mymod );
+
+				ClientPacketHandlers.SendRequestModSettingsFromClient( mymod );
+				ClientPacketHandlers.SendRequestModDataFromClient( mymod );
+			}
+		}
+		private void OnServerConnect() {
+			if( player.whoAmI == this.player.whoAmI ) {    // Current player
+				var mymod = (TheLunaticMod)this.mod;
+				var myworld = mymod.GetModWorld<TheLunaticWorld>();
+
+				myworld.GameLogic.ApplyDebugOverrides( mymod );
+			}
+		}
+

 		public void PostEnterWorld() {
 			var mymod = (TheLunaticMod)this.mod;


Better `AddGraphic` syntax w/o string.Concat.

--- TinySato/Graphic.cs
+++ TinySato/Graphic.cs
@@ -44,28 +44,19 @@
                 original.Width - (original.Width % 8),
                 original.Height - (original.Height % 8));

-            using (var clone = original.Clone(region, PixelFormat.Format1bppIndexed))
-            {
-                var bmp = clone.LockBits(region, ImageLockMode.ReadOnly, PixelFormat.Format1bppIndexed);
-                var bmp1bit = new byte[bmp.Height * Math.Abs(bmp.Stride)];
-                Marshal.Copy(bmp.Scan0, bmp1bit, 0, bmp1bit.Length);
-                clone.UnlockBits(bmp);
+            var bmp = original.LockBits(region, ImageLockMode.ReadOnly, PixelFormat.Format1bppIndexed);
+            var stride = Math.Abs(bmp.Stride);
+            var real_stride = bmp.Width / 8;
+            var bmp1bit = new byte[bmp.Height * stride];
+            Marshal.Copy(bmp.Scan0, bmp1bit, 0, bmp1bit.Length);
+            original.UnlockBits(bmp);

-                var stride = Math.Abs(bmp.Stride);
-                var real_stride = bmp.Width / 8;
-                var graphic = string.Empty;
-                for (var i = 0; i < bmp1bit.Length; i += stride)
-                {
-                    graphic +=
-                        string.Join("",
-                            bmp1bit.Skip(i)
-                            .Take(real_stride)
-                            .Select(bits => ((byte)~bits).ToString("X2")));
-                }
+            var graphic = string.Join("",
+                Enumerable.Range(0, bmp1bit.Length).Where(i => i % stride < real_stride)
+                .Select(i => ((byte)~bmp1bit[i]).ToString("X2")).ToArray());

-                this.printer.Add(string.Format("GH{0:D3}{1:D3}{2}",
-                    region.Width / 8, region.Height / 8, graphic));
-            }
+            this.printer.Add(string.Format("GH{0:D3}{1:D3}{2}",
+                region.Width / 8, region.Height / 8, graphic));
         }

         public void AddBox(int horizontal_line_width, int vertical_line_width, int width, int height)


Adjust default player height once ahgain.

Signed-off-by: V10lator <fd1911a80a45064cec08d87c592168c9000a1489@myway.de>

--- UltimateSettings.cs
+++ UltimateSettings.cs
@@ -16,7 +16,7 @@
 		internal const string HEIGHT_SETTING = "Player height";
 		internal const float MIN_HEIGHT = 0.3f;
 		internal const float MAX_HEIGHT = 2.0f;
-		internal const float DEFAULT_HEIGHT = 0.503f;
+		internal const float DEFAULT_HEIGHT = 0.4f;
 		internal const string FOV_SETTING = "Field of view";
 		internal const float MIN_FOV = 20.0f;
 		internal const float MAX_FOV = 130.0f;


Bug fix Color processing

Bug fix Color processing

Modify all type of dimension

close #15

--- Utils/ColorUtils.cs
+++ Utils/ColorUtils.cs
@@ -64,7 +64,7 @@
                 Entity entity = transaction.GetObject(entId, OpenMode.ForRead) as Entity;
                 if (entity == null)
                     continue;
-                RotatedDimension dim = entity as RotatedDimension;
+                Dimension dim = entity as Dimension;
                 BlockReference blockRef = entity as BlockReference;
                 if (blockRef != null)
                     ProcessingDwgsColorEntities(blockRef.BlockTableRecord, transaction, colorFunc);
@@ -73,7 +73,7 @@
             }
         }

-        private static void ProcessingEntityColor(Func<Color, Color> colorFunc, Entity entity, Transparency trans, RotatedDimension dim)
+        private static void ProcessingEntityColor(Func<Color, Color> colorFunc, Entity entity, Transparency trans, Dimension dim)
         {
             if (!entity.Color.IsByLayer)
             {


Added error message for duplicate imports

--- VM12/T12/Emitter.cs
+++ VM12/T12/Emitter.cs
@@ -1296,6 +1296,9 @@
                 if (ast.Files.TryGetValue(import.File, out var importFile) == false)
                     Fail(import.Trace, $"Could not find import file '{import.File}'!");

+                if (importMap.ContainsKey(import.File))
+                    Fail(import.Trace, $"File '{import.File}' is already imported!");
+
                 importMap.Add(import.File, importFile.File);
             }


TaskDispatcher will use non-blocking code ( close #24 ).

--- DarkFlow/Execution/TaskDispatcher.cs
+++ DarkFlow/Execution/TaskDispatcher.cs
@@ -1,4 +1,5 @@
 using System;
+using System.Diagnostics;
 using System.Linq;
 using System.Threading;
 using System.Threading.Tasks;
@@ -13,27 +14,33 @@
         private int _taskPending;
         private int _currentConcurrency;
         private readonly ExecutionInfo[] _executionInfos;
-        private readonly object _latch;

         private class ExecutionInfo
         {
+            //TODO I guess more sophisticated sync could be involved.
             public volatile Task TplTask;
+            public volatile ExecutionEnvelope CurrentTask;
+            public volatile int OwnedCellIndex;

-            public volatile ExecutionEnvelope CurrentTask;
-
-            public bool Free
+            public ExecutionInfo()
             {
-                get { return TplTask == null; }
+                OwnedCellIndex = -1;
             }

-            public bool OwnedByCurrentTask
+            public void WaitTaskFinished()
             {
-                get
+                var tplTask = TplTask;
+
+                if (tplTask != null)
                 {
-                    var tplTask = TplTask;
-                    if (tplTask == null) return false;
-                    return tplTask.Id == Task.CurrentId;
+                    TplTask.Wait();
                 }
+            }
+
+            public void Release()
+            {
+                OwnedCellIndex = -1;
+                CurrentTask = null;
             }
         }

@@ -59,12 +66,7 @@
             _maxConcurrency = Math.Min(maxConcurrency, queueTotalConcurrency);
             _executionQueues = executionQueues.OrderByDescending(x => x.Priority).ToArray();

-            _executionInfos =
-                Enumerable.Range(0, _maxConcurrency)
-                .Select(x => new ExecutionInfo())
-                .ToArray();
-
-            _latch = new object();
+            _executionInfos = new ExecutionInfo[_maxConcurrency];

             foreach (var executionQueue in executionQueues)
             {
@@ -90,15 +92,21 @@

             if (currentConcurrency <= _maxConcurrency)
             {
-                var task = new Task(PerformTasks);
-
-                //TODO Possible it better to do using Interlocked.Exchange.
+                var executionInfo = new ExecutionInfo();
+                var task = new Task(PerformTasks, executionInfo);

-                Monitor.Enter(_latch);
-                var executionInfo = _executionInfos.First(x => x.Free);
-                executionInfo.TplTask = task;
-                Monitor.Exit(_latch);
+                for (int i = 0; i < _executionInfos.Length; i++)
+                {
+                    var originalValue =  Interlocked.CompareExchange(ref _executionInfos[0], executionInfo, null);
+                    var cellAlreadyOwned = originalValue != null;

+                    if (cellAlreadyOwned) continue;
+
+                    executionInfo.OwnedCellIndex = i;
+                    executionInfo.TplTask = task;
+
+                    break;
+                }
                 task.Start();
             }
             else
@@ -107,12 +115,17 @@
             }
         }

-        private void PerformTasks()
+        private void PerformTasks(object state)
         {
-            var executionInfo = _executionInfos.Single(x => x.OwnedByCurrentTask);
+            var executionInfo = (ExecutionInfo) state;

             while (true)
             {
+                if (DisposeInProgress || Disposed)
+                {
+                    break;
+                }
+
                 var envelope = TakeNextTask();

                 executionInfo.CurrentTask = envelope;
@@ -123,16 +136,15 @@
                 }

                 envelope.ExecuteTask();
-
-                if (DisposeInProgress || Disposed)
-                {
-                    break;
-                }
-
             }

-            executionInfo.CurrentTask = null;
-            executionInfo.TplTask = null;
+            //ExecutionInfo.Release() drops the index. So it preserved.
+            var index = executionInfo.OwnedCellIndex;
+
+            executionInfo.Release();
+
+            _executionQueues[index] = null;
+

             Interlocked.Decrement(ref _currentConcurrency);
         }
@@ -154,9 +166,16 @@
         }
         protected override void DisposeManaged()
         {
-            foreach (var info in _executionInfos.Where(info => !info.Free))
+            for (int i = 0; i < _executionInfos.Length; i++)
             {
-                info.TplTask.Wait();
+                var executionInfo = _executionInfos[i];
+
+                Thread.MemoryBarrier();
+
+                if (executionInfo != null)
+                {
+                    executionInfo.WaitTaskFinished();
+                }
             }
         }
     }