show parents of diffed nodes

show parents of diffed nodes

--- msvc/kowhai_sharp/KowhaiTree.cs
+++ msvc/kowhai_sharp/KowhaiTree.cs
@@ -522,8 +522,9 @@
         public void _diffAt(Kowhai.kowhai_symbol_t[] symbolPath, bool[] symbolPathMatchesArrayIndex, int symbolPathIndex, TreeNode node)
         {
             KowhaiNodeInfo info = (KowhaiNodeInfo)node.Tag;
-            bool isBranchArrayItem = info.IsArrayItem && (info.KowhaiNode.type == Kowhai.BRANCH_START || info.KowhaiNode.type == Kowhai.BRANCH_U_START);
-            bool isLeafArrayParent = node.Nodes.Count > 0 && (info.KowhaiNode.type != Kowhai.BRANCH_START && info.KowhaiNode.type != Kowhai.BRANCH_U_START);
+            bool isBranch = info.KowhaiNode.type == Kowhai.BRANCH_START || info.KowhaiNode.type == Kowhai.BRANCH_U_START;
+            bool isBranchArrayItem = info.IsArrayItem && isBranch;
+            bool isLeafArrayParent = node.Nodes.Count > 0 && !isBranch;
             // poplulate symbolPathMatchesArrayIndex to ensure we are on the correct branch of the treeview
             if (isBranchArrayItem)
                 symbolPathMatchesArrayIndex[symbolPathIndex - 1] = info.ArrayIndex == symbolPath[symbolPathIndex - 1].parts.array_index;
@@ -533,6 +534,9 @@
                     return;
                 symbolPathMatchesArrayIndex[symbolPathIndex] = info.ArrayIndex == symbolPath[symbolPathIndex].parts.array_index;
             }
+            // color treeview node orange is match in this branch
+            if (!symbolPathMatchesArrayIndex.Take(symbolPathIndex).Contains(false))
+                node.BackColor = Color.Yellow;
             // color treeview node red is match is found
             if (symbolPathIndex == symbolPath.Length - 1 && !symbolPathMatchesArrayIndex.Contains(false) &&
                 !isLeafArrayParent && !isBranchArrayItem)


Add missing vault_token property to PaymentSource

--- sdk/Models/PaymentSource.cs
+++ sdk/Models/PaymentSource.cs
@@ -14,6 +14,7 @@
     public class PaymentSource
     {
         public string gateway_id { get; set; }
+				public string vault_token { get; set; }
         [JsonConverter(typeof(StringEnumConverter))]
         public PaymentType type { get; set; }
         public string account_name { get; set; }


null is a keyword

null is a keyword

--- sdmap/src/sdmap.vstool/Tagger/CodeHighlightTagger.cs
+++ sdmap/src/sdmap.vstool/Tagger/CodeHighlightTagger.cs
@@ -59,6 +59,7 @@
                 case KNamespace:
                 case KIf:
                 case KElse:
+                case Null:
                     return svr.Keyword;
                 case OpenCurlyBrace:
                 case CloseCurlyBrace:


Add tolerance checks for tests in space-age

The tests numbers are rounded off but don't have any tolerance checking.
They fail if the number isn't exactly the same.

--- space-age/SpaceAgeTest.cs
+++ space-age/SpaceAgeTest.cs
@@ -16,7 +16,7 @@
     public void Age_on_earth()
     {
         var age = new SpaceAge(1000000000);
-        Assert.That(age.OnEarth(), Is.EqualTo(31.69));
+        Assert.That(age.OnEarth(), Is.EqualTo(31.69).Within(1E-02));
     }

     [Ignore]
@@ -24,8 +24,8 @@
     public void Age_on_mercury()
     {
         var age = new SpaceAge(2134835688);
-        Assert.That(age.OnEarth(), Is.EqualTo(67.65));
-        Assert.That(age.OnMercury(), Is.EqualTo(280.88));
+        Assert.That(age.OnEarth(), Is.EqualTo(67.65).Within(1E-02));
+        Assert.That(age.OnMercury(), Is.EqualTo(280.88).Within(1E-02));
     }

     [Ignore]
@@ -33,8 +33,8 @@
     public void Age_on_venus()
     {
         var age = new SpaceAge(189839836);
-        Assert.That(age.OnEarth(), Is.EqualTo(6.02));
-        Assert.That(age.OnVenus(), Is.EqualTo(9.78));
+        Assert.That(age.OnEarth(), Is.EqualTo(6.02).Within(1E-02));
+        Assert.That(age.OnVenus(), Is.EqualTo(9.78).Within(1E-02));
     }

     [Ignore]
@@ -42,8 +42,8 @@
     public void Age_on_mars()
     {
         var age = new SpaceAge(2329871239);
-        Assert.That(age.OnEarth(), Is.EqualTo(73.83));
-        Assert.That(age.OnMars(), Is.EqualTo(39.25));
+        Assert.That(age.OnEarth(), Is.EqualTo(73.83).Within(1E-02));
+        Assert.That(age.OnMars(), Is.EqualTo(39.25).Within(1E-02));
     }

     [Ignore]
@@ -51,8 +51,8 @@
     public void Age_on_jupiter()
     {
         var age = new SpaceAge(901876382);
-        Assert.That(age.OnEarth(), Is.EqualTo(28.58));
-        Assert.That(age.OnJupiter(), Is.EqualTo(2.41));
+        Assert.That(age.OnEarth(), Is.EqualTo(28.58).Within(1E-02));
+        Assert.That(age.OnJupiter(), Is.EqualTo(2.41).Within(1E-02));
     }

     [Ignore]
@@ -60,8 +60,8 @@
     public void Age_on_saturn()
     {
         var age = new SpaceAge(3000000000);
-        Assert.That(age.OnEarth(), Is.EqualTo(95.06));
-        Assert.That(age.OnSaturn(), Is.EqualTo(3.23));
+        Assert.That(age.OnEarth(), Is.EqualTo(95.06).Within(1E-02));
+        Assert.That(age.OnSaturn(), Is.EqualTo(3.23).Within(1E-02));
     }

     [Ignore]
@@ -69,8 +69,8 @@
     public void Age_on_uranus()
     {
         var age = new SpaceAge(3210123456);
-        Assert.That(age.OnEarth(), Is.EqualTo(101.72));
-        Assert.That(age.OnUranus(), Is.EqualTo(1.21));
+        Assert.That(age.OnEarth(), Is.EqualTo(101.72).Within(1E-02));
+        Assert.That(age.OnUranus(), Is.EqualTo(1.21).Within(1E-02));
     }

     [Ignore]
@@ -78,7 +78,7 @@
     public void Age_on_neptune()
     {
         var age = new SpaceAge(8210123456);
-        Assert.That(age.OnEarth(), Is.EqualTo(260.16));
-        Assert.That(age.OnNeptune(), Is.EqualTo(1.58));
+        Assert.That(age.OnEarth(), Is.EqualTo(260.16).Within(1E-02));
+        Assert.That(age.OnNeptune(), Is.EqualTo(1.58).Within(1E-02));
     }
 }


fix whitespace

fix whitespace

--- src/ServiceStack.Text/JsConfig.cs
+++ src/ServiceStack.Text/JsConfig.cs
@@ -434,7 +434,7 @@
             tsJsvTypeAttrInObject = sJsvTypeAttrInObject = null;
             tsTypeWriter = sTypeWriter = null;
             tsTypeFinder = sTypeFinder = null;
-            tsTreatEnumAsInteger = sTreatEnumAsInteger = null;
+			tsTreatEnumAsInteger = sTreatEnumAsInteger = null;
             tsAlwaysUseUtc = sAlwaysUseUtc = null;
             HasSerializeFn = new HashSet<Type>();
             TreatValueAsRefTypes = new HashSet<Type> { typeof(KeyValuePair<,>) };
@@ -447,13 +447,13 @@
         /// Just needs to be called once in a static constructor.
         /// </summary>
         [MonoTouch.Foundation.Preserve]
-        public static void InitForAot() {
-        }
+		public static void InitForAot() {
+		}

         [MonoTouch.Foundation.Preserve]
         public static void RegisterForAot()
         {
-            RegisterTypeForAot<Poco>();
+			RegisterTypeForAot<Poco>();

             RegisterElement<Poco, string>();

@@ -466,7 +466,7 @@
             RegisterElement<Poco, int>();
             RegisterElement<Poco, uint>();

-            RegisterElement<Poco, long>();
+			RegisterElement<Poco, long>();
             RegisterElement<Poco, ulong>();
             RegisterElement<Poco, float>();
             RegisterElement<Poco, double>();
@@ -486,24 +486,24 @@
             RegisterElement<Poco, double?>();
             RegisterElement<Poco, decimal?>();

-            //RegisterElement<Poco, JsonValue>();
-
-            RegisterTypeForAot<DayOfWeek>(); // used by DateTime
-
-            // register built in structs
-            RegisterTypeForAot<Guid>();
-            RegisterTypeForAot<TimeSpan>();
-            RegisterTypeForAot<DateTime>();
-            RegisterTypeForAot<DateTime?>();
-            RegisterTypeForAot<TimeSpan?>();
-            RegisterTypeForAot<Guid?>();
-        }
-
-        [MonoTouch.Foundation.Preserve]
-        public static void RegisterTypeForAot<T>()
-        {
-            AotConfig.RegisterSerializers<T>();
-        }
+			//RegisterElement<Poco, JsonValue>();
+
+			RegisterTypeForAot<DayOfWeek>(); // used by DateTime
+
+			// register built in structs
+			RegisterTypeForAot<Guid>();
+			RegisterTypeForAot<TimeSpan>();
+			RegisterTypeForAot<DateTime>();
+			RegisterTypeForAot<DateTime?>();
+			RegisterTypeForAot<TimeSpan?>();
+			RegisterTypeForAot<Guid?>();
+        }
+
+		[MonoTouch.Foundation.Preserve]
+		public static void RegisterTypeForAot<T>()
+		{
+			AotConfig.RegisterSerializers<T>();
+		}

         [MonoTouch.Foundation.Preserve]
         static void RegisterQueryStringWriter()
@@ -511,149 +511,149 @@
             var i = 0;
             if (QueryStringWriter<Poco>.WriteFn() != null) i++;
         }
-
+
         [MonoTouch.Foundation.Preserve]
-        internal static int RegisterElement<T, TElement>()
-        {
-            var i = 0;
-            i += AotConfig.RegisterSerializers<TElement>();
-            AotConfig.RegisterElement<T, TElement, JsonTypeSerializer>();
-            AotConfig.RegisterElement<T, TElement, JsvTypeSerializer>();
-            return i;
-        }
-
-        ///<summary>
-        /// Class contains Ahead-of-Time (AOT) explicit class declarations which is used only to workaround "-aot-only" exceptions occured on device only.
-        /// </summary>
-        [MonoTouch.Foundation.Preserve(AllMembers=true)]
-        internal class AotConfig
-        {
-            internal static JsReader<JsonTypeSerializer> jsonReader;
-            internal static JsWriter<JsonTypeSerializer> jsonWriter;
-            internal static JsReader<JsvTypeSerializer> jsvReader;
-            internal static JsWriter<JsvTypeSerializer> jsvWriter;
-            internal static JsonTypeSerializer jsonSerializer;
-            internal static JsvTypeSerializer jsvSerializer;
-
-            static AotConfig()
-            {
-                jsonSerializer = new JsonTypeSerializer();
-                jsvSerializer = new JsvTypeSerializer();
-                jsonReader = new JsReader<JsonTypeSerializer>();
-                jsonWriter = new JsWriter<JsonTypeSerializer>();
-                jsvReader = new JsReader<JsvTypeSerializer>();
-                jsvWriter = new JsWriter<JsvTypeSerializer>();
-            }
-
-            internal static int RegisterSerializers<T>()
-            {
-                var i = 0;
-                i += Register<T, JsonTypeSerializer>();
-                if (jsonSerializer.GetParseFn<T>() != null) i++;
-                if (jsonSerializer.GetWriteFn<T>() != null) i++;
-                if (jsonReader.GetParseFn<T>() != null) i++;
-                if (jsonWriter.GetWriteFn<T>() != null) i++;
-
-                i += Register<T, JsvTypeSerializer>();
-                if (jsvSerializer.GetParseFn<T>() != null) i++;
-                if (jsvSerializer.GetWriteFn<T>() != null) i++;
-                if (jsvReader.GetParseFn<T>() != null) i++;
-                if (jsvWriter.GetWriteFn<T>() != null) i++;
-
-
-                //RegisterCsvSerializer<T>();
-                RegisterQueryStringWriter();
-                return i;
-            }
-
-            internal static void RegisterCsvSerializer<T>()
-            {
-                CsvSerializer<T>.WriteFn();
-                CsvSerializer<T>.WriteObject(null, null);
-                CsvWriter<T>.Write(null, default(IEnumerable<T>));
-                CsvWriter<T>.WriteRow(null, default(T));
-            }
-
-            public static ParseStringDelegate GetParseFn(Type type)
-            {
-                var parseFn = JsonTypeSerializer.Instance.GetParseFn(type);
-                return parseFn;
-            }
-
-            internal static int Register<T, TSerializer>() where TSerializer : ITypeSerializer
-            {
-                var i = 0;
-
-                if (JsonWriter<T>.WriteFn() != null) i++;
-                if (JsonWriter.Instance.GetWriteFn<T>() != null) i++;
-                if (JsonReader.Instance.GetParseFn<T>() != null) i++;
-                if (JsonReader<T>.Parse(null) != null) i++;
-                if (JsonReader<T>.GetParseFn() != null) i++;
-                //if (JsWriter.GetTypeSerializer<JsonTypeSerializer>().GetWriteFn<T>() != null) i++;
-                if (new List<T>() != null) i++;
-                if (new T[0] != null) i++;
-
-                JsConfig<T>.ExcludeTypeInfo = false;
-
-                if (JsConfig<T>.OnDeserializedFn != null) i++;
-                if (JsConfig<T>.HasDeserializeFn) i++;
-                if (JsConfig<T>.SerializeFn != null) i++;
-                if (JsConfig<T>.DeSerializeFn != null) i++;
-                //JsConfig<T>.SerializeFn = arg => "";
-                //JsConfig<T>.DeSerializeFn = arg => default(T);
-                if (TypeConfig<T>.Properties != null) i++;
+		internal static int RegisterElement<T, TElement>()
+        {
+			var i = 0;
+			i += AotConfig.RegisterSerializers<TElement>();
+			AotConfig.RegisterElement<T, TElement, JsonTypeSerializer>();
+			AotConfig.RegisterElement<T, TElement, JsvTypeSerializer>();
+			return i;
+		}
+
+		///<summary>
+		/// Class contains Ahead-of-Time (AOT) explicit class declarations which is used only to workaround "-aot-only" exceptions occured on device only.
+		/// </summary>
+		[MonoTouch.Foundation.Preserve(AllMembers=true)]
+		internal class AotConfig
+		{
+			internal static JsReader<JsonTypeSerializer> jsonReader;
+			internal static JsWriter<JsonTypeSerializer> jsonWriter;
+			internal static JsReader<JsvTypeSerializer> jsvReader;
+			internal static JsWriter<JsvTypeSerializer> jsvWriter;
+			internal static JsonTypeSerializer jsonSerializer;
+			internal static JsvTypeSerializer jsvSerializer;
+
+			static AotConfig()
+			{
+				jsonSerializer = new JsonTypeSerializer();
+				jsvSerializer = new JsvTypeSerializer();
+				jsonReader = new JsReader<JsonTypeSerializer>();
+				jsonWriter = new JsWriter<JsonTypeSerializer>();
+				jsvReader = new JsReader<JsvTypeSerializer>();
+				jsvWriter = new JsWriter<JsvTypeSerializer>();
+			}
+
+			internal static int RegisterSerializers<T>()
+			{
+				var i = 0;
+				i += Register<T, JsonTypeSerializer>();
+				if (jsonSerializer.GetParseFn<T>() != null) i++;
+				if (jsonSerializer.GetWriteFn<T>() != null) i++;
+				if (jsonReader.GetParseFn<T>() != null) i++;
+				if (jsonWriter.GetWriteFn<T>() != null) i++;
+
+				i += Register<T, JsvTypeSerializer>();
+				if (jsvSerializer.GetParseFn<T>() != null) i++;
+				if (jsvSerializer.GetWriteFn<T>() != null) i++;
+				if (jsvReader.GetParseFn<T>() != null) i++;
+				if (jsvWriter.GetWriteFn<T>() != null) i++;
+
+
+				//RegisterCsvSerializer<T>();
+				RegisterQueryStringWriter();
+				return i;
+			}
+
+			internal static void RegisterCsvSerializer<T>()
+			{
+				CsvSerializer<T>.WriteFn();
+				CsvSerializer<T>.WriteObject(null, null);
+				CsvWriter<T>.Write(null, default(IEnumerable<T>));
+				CsvWriter<T>.WriteRow(null, default(T));
+			}
+
+			public static ParseStringDelegate GetParseFn(Type type)
+			{
+				var parseFn = JsonTypeSerializer.Instance.GetParseFn(type);
+				return parseFn;
+			}
+
+			internal static int Register<T, TSerializer>() where TSerializer : ITypeSerializer
+			{
+				var i = 0;
+
+				if (JsonWriter<T>.WriteFn() != null) i++;
+				if (JsonWriter.Instance.GetWriteFn<T>() != null) i++;
+				if (JsonReader.Instance.GetParseFn<T>() != null) i++;
+				if (JsonReader<T>.Parse(null) != null) i++;
+				if (JsonReader<T>.GetParseFn() != null) i++;
+				//if (JsWriter.GetTypeSerializer<JsonTypeSerializer>().GetWriteFn<T>() != null) i++;
+				if (new List<T>() != null) i++;
+				if (new T[0] != null) i++;
+
+				JsConfig<T>.ExcludeTypeInfo = false;
+
+				if (JsConfig<T>.OnDeserializedFn != null) i++;
+				if (JsConfig<T>.HasDeserializeFn) i++;
+				if (JsConfig<T>.SerializeFn != null) i++;
+				if (JsConfig<T>.DeSerializeFn != null) i++;
+				//JsConfig<T>.SerializeFn = arg => "";
+				//JsConfig<T>.DeSerializeFn = arg => default(T);
+				if (TypeConfig<T>.Properties != null) i++;

 /*
-                if (WriteType<T, TSerializer>.Write != null) i++;
-                if (WriteType<object, TSerializer>.Write != null) i++;
-
-                if (DeserializeBuiltin<T>.Parse != null) i++;
-                if (DeserializeArray<T[], TSerializer>.Parse != null) i++;
-                DeserializeType<TSerializer>.ExtractType(null);
-                DeserializeArrayWithElements<T, TSerializer>.ParseGenericArray(null, null);
-                DeserializeCollection<TSerializer>.ParseCollection<T>(null, null, null);
-                DeserializeListWithElements<T, TSerializer>.ParseGenericList(null, null, null);
-
-                SpecializedQueueElements<T>.ConvertToQueue(null);
-                SpecializedQueueElements<T>.ConvertToStack(null);
+				if (WriteType<T, TSerializer>.Write != null) i++;
+				if (WriteType<object, TSerializer>.Write != null) i++;
+
+				if (DeserializeBuiltin<T>.Parse != null) i++;
+				if (DeserializeArray<T[], TSerializer>.Parse != null) i++;
+				DeserializeType<TSerializer>.ExtractType(null);
+				DeserializeArrayWithElements<T, TSerializer>.ParseGenericArray(null, null);
+				DeserializeCollection<TSerializer>.ParseCollection<T>(null, null, null);
+				DeserializeListWithElements<T, TSerializer>.ParseGenericList(null, null, null);
+
+				SpecializedQueueElements<T>.ConvertToQueue(null);
+				SpecializedQueueElements<T>.ConvertToStack(null);
 */

-                WriteListsOfElements<T, TSerializer>.WriteList(null, null);
-                WriteListsOfElements<T, TSerializer>.WriteIList(null, null);
-                WriteListsOfElements<T, TSerializer>.WriteEnumerable(null, null);
-                WriteListsOfElements<T, TSerializer>.WriteListValueType(null, null);
-                WriteListsOfElements<T, TSerializer>.WriteIListValueType(null, null);
-                WriteListsOfElements<T, TSerializer>.WriteGenericArrayValueType(null, null);
-                WriteListsOfElements<T, TSerializer>.WriteArray(null, null);
-
-                TranslateListWithElements<T>.LateBoundTranslateToGenericICollection(null, null);
-                TranslateListWithConvertibleElements<T, T>.LateBoundTranslateToGenericICollection(null, null);
-
-                QueryStringWriter<T>.WriteObject(null, null);
-                return i;
-            }
-
-            internal static void RegisterElement<T, TElement, TSerializer>() where TSerializer : ITypeSerializer
-            {
-                DeserializeDictionary<TSerializer>.ParseDictionary<T, TElement>(null, null, null, null);
-                DeserializeDictionary<TSerializer>.ParseDictionary<TElement, T>(null, null, null, null);
-
-                ToStringDictionaryMethods<T, TElement, TSerializer>.WriteIDictionary(null, null, null, null);
-                ToStringDictionaryMethods<TElement, T, TSerializer>.WriteIDictionary(null, null, null, null);
-
-                // Include List deserialisations from the Register<> method above.  This solves issue where List<Guid> properties on responses deserialise to null.
-                // No idea why this is happening because there is no visible exception raised.  Suspect MonoTouch is swallowing an AOT exception somewhere.
-                DeserializeArrayWithElements<TElement, TSerializer>.ParseGenericArray(null, null);
-                DeserializeListWithElements<TElement, TSerializer>.ParseGenericList(null, null, null);
-
-                // Cannot use the line below for some unknown reason - when trying to compile to run on device, mtouch bombs during native code compile.
-                // Something about this line or its inner workings is offensive to mtouch. Luckily this was not needed for my List<Guide> issue.
-                // DeserializeCollection<JsonTypeSerializer>.ParseCollection<TElement>(null, null, null);
-
-                TranslateListWithElements<TElement>.LateBoundTranslateToGenericICollection(null, typeof(List<TElement>));
-                TranslateListWithConvertibleElements<TElement, TElement>.LateBoundTranslateToGenericICollection(null, typeof(List<TElement>));
-            }
-        }
+				WriteListsOfElements<T, TSerializer>.WriteList(null, null);
+				WriteListsOfElements<T, TSerializer>.WriteIList(null, null);
+				WriteListsOfElements<T, TSerializer>.WriteEnumerable(null, null);
+				WriteListsOfElements<T, TSerializer>.WriteListValueType(null, null);
+				WriteListsOfElements<T, TSerializer>.WriteIListValueType(null, null);
+				WriteListsOfElements<T, TSerializer>.WriteGenericArrayValueType(null, null);
+				WriteListsOfElements<T, TSerializer>.WriteArray(null, null);
+
+				TranslateListWithElements<T>.LateBoundTranslateToGenericICollection(null, null);
+				TranslateListWithConvertibleElements<T, T>.LateBoundTranslateToGenericICollection(null, null);
+
+				QueryStringWriter<T>.WriteObject(null, null);
+				return i;
+			}
+
+			internal static void RegisterElement<T, TElement, TSerializer>() where TSerializer : ITypeSerializer
+			{
+				DeserializeDictionary<TSerializer>.ParseDictionary<T, TElement>(null, null, null, null);
+				DeserializeDictionary<TSerializer>.ParseDictionary<TElement, T>(null, null, null, null);
+
+				ToStringDictionaryMethods<T, TElement, TSerializer>.WriteIDictionary(null, null, null, null);
+				ToStringDictionaryMethods<TElement, T, TSerializer>.WriteIDictionary(null, null, null, null);
+
+				// Include List deserialisations from the Register<> method above.  This solves issue where List<Guid> properties on responses deserialise to null.
+				// No idea why this is happening because there is no visible exception raised.  Suspect MonoTouch is swallowing an AOT exception somewhere.
+				DeserializeArrayWithElements<TElement, TSerializer>.ParseGenericArray(null, null);
+				DeserializeListWithElements<TElement, TSerializer>.ParseGenericList(null, null, null);
+
+				// Cannot use the line below for some unknown reason - when trying to compile to run on device, mtouch bombs during native code compile.
+				// Something about this line or its inner workings is offensive to mtouch. Luckily this was not needed for my List<Guide> issue.
+				// DeserializeCollection<JsonTypeSerializer>.ParseCollection<TElement>(null, null, null);
+
+				TranslateListWithElements<TElement>.LateBoundTranslateToGenericICollection(null, typeof(List<TElement>));
+				TranslateListWithConvertibleElements<TElement, TElement>.LateBoundTranslateToGenericICollection(null, typeof(List<TElement>));
+			}
+		}

 #endif


Refactor StringSegment usage

Refactor StringSegment usage

Refactor StringSegment usage to use string.Empty and the implicit
conversion so that the instance method can be used instead as it's
guaranteed to be non-null now.

--- src/API/Controllers/HomeController.cs
+++ src/API/Controllers/HomeController.cs
@@ -57,8 +57,8 @@
         /// </returns>
         private bool IsJsonRequest()
         {
-            var mediaType = Request.GetTypedHeaders().Accept?.FirstOrDefault()?.MediaType ?? StringSegment.Empty;
-            return StringSegment.Equals(mediaType, "application/json", StringComparison.OrdinalIgnoreCase);
+            var mediaType = Request.GetTypedHeaders().Accept?.FirstOrDefault()?.MediaType ?? string.Empty;
+            return mediaType.Equals("application/json", StringComparison.OrdinalIgnoreCase);
         }

         /// <summary>


Fixed translator names not separated properly in about box

--- source/BulkCrapUninstaller/Forms/Windows/AboutBox.cs
+++ source/BulkCrapUninstaller/Forms/Windows/AboutBox.cs
@@ -40,13 +40,13 @@
                 new {culture =  CultureInfo.GetCultureInfo("cs-CZ"), translator = "Richard Kahl"},

                 // de - German
-                new {culture =  CultureInfo.GetCultureInfo("de"), translator = "Dieter Hummel & Thomas Werk"},
+                new {culture =  CultureInfo.GetCultureInfo("de"), translator = "Dieter Hummel, Thomas Werk"},

                 // es - Spanish
-                new {culture =  CultureInfo.GetCultureInfo("es"), translator = "MS-PC2 & Freddynic159 & Emilio J. Grao"},
+                new {culture =  CultureInfo.GetCultureInfo("es"), translator = "MS-PC2, Freddynic159, Emilio J. Grao"},

                 // fr - French
-                new {culture =  CultureInfo.GetCultureInfo("fr"), translator = "Thierry Delaunay & Orphée V."},
+                new {culture =  CultureInfo.GetCultureInfo("fr"), translator = "Thierry Delaunay, Orphée V."},

                 // Hungarian
                 new {culture =  CultureInfo.GetCultureInfo("hu"), translator = "Phoenix (Döbröntei Sándor)"},


Nameing (8815092)

Nameing (8815092)

--- src/Adaptive.Aeron/ClientConductor.cs
+++ src/Adaptive.Aeron/ClientConductor.cs
@@ -296,14 +296,14 @@
             return workCount;
         }

-        private void AwaitResponse(long correlationId, string expectedChannel, bool slowOperation)
+        private void AwaitResponse(long correlationId, string expectedChannel, bool isSlowOperation)
         {
             _driverException = null;
             var timeout = _nanoClock.NanoTime() + _driverTimeoutNs;

             do
             {
-                if (slowOperation)
+                if (isSlowOperation)
                 {
                     Thread.Sleep(1);
                 }


Remove Class1.cs

Remove Class1.cs

--- src/Alioth.Framework.Config/Class1.cs
+++ src/Alioth.Framework.Config/Class1.cs
@@ -1,8 +0,0 @@
-using System;
-
-namespace Alioth.Framework.Config
-{
-    public class Class1
-    {
-    }
-}


useless allocations

useless allocations

--- src/AutoMapper/MapperConfiguration.cs
+++ src/AutoMapper/MapperConfiguration.cs
@@ -23,6 +23,7 @@
         private readonly IList<Profile> _profiles = new List<Profile>();
         private readonly ConfigurationValidator _validator;
         private Func<Type, object> _serviceCtor = ObjectCreator.CreateObject;
+        private Func<TypePair, TypeMap> _getTypeMap;

         public MapperConfiguration(Action<IMapperConfiguration> configure) : this(configure, MapperRegistry.Mappers, TypeMapObjectMapperRegistry.Mappers)
@@ -46,6 +47,7 @@
             Seal();

             ExpressionBuilder = new ExpressionBuilder(this);
+            _getTypeMap = GetTypeMap;
         }

         public string ProfileName => "";
@@ -198,18 +200,27 @@

         public TypeMap ResolveTypeMap(TypePair typePair)
         {
-            var typeMap = _typeMapPlanCache.GetOrAdd(typePair, pair => pair.GetRelatedTypePairs()
-                .Select(
-                    tp =>
-                        _typeMapPlanCache.GetOrDefault(tp) ??
-                        FindTypeMapFor(tp) ??
-                        (!CoveredByObjectMap(pair)
-                            ? FindConventionTypeMapFor(tp) ??
-                              FindClosedGenericTypeMapFor(tp)
-                            : null))
-                .FirstOrDefault(tm => tm != null));
-
+            var typeMap = _typeMapPlanCache.GetOrAdd(typePair, _getTypeMap);
             return typeMap;
+        }
+
+        private TypeMap GetTypeMap(TypePair pair)
+        {
+            foreach(var tp in pair.GetRelatedTypePairs())
+            {
+                var typeMap =
+                          _typeMapPlanCache.GetOrDefault(tp) ??
+                          FindTypeMapFor(tp) ??
+                          (!CoveredByObjectMap(pair)
+                              ? FindConventionTypeMapFor(tp) ??
+                                FindClosedGenericTypeMapFor(tp)
+                              : null);
+                if(typeMap != null)
+                {
+                    return typeMap;
+                }
+            }
+            return null;
         }

         public TypeMap ResolveTypeMap(object source, object destination, Type sourceType, Type destinationType)


Set RenderedGeometry.Transform on arrange.

Fixes #4822 but breaks a bunch of other tests.

--- src/Avalonia.Controls/Shapes/Shape.cs
+++ src/Avalonia.Controls/Shapes/Shape.cs
@@ -248,52 +248,21 @@

         protected override Size MeasureOverride(Size availableSize)
         {
-            bool deferCalculateTransform;
-            switch (Stretch)
-            {
-                case Stretch.Fill:
-                case Stretch.UniformToFill:
-                    deferCalculateTransform = double.IsInfinity(availableSize.Width) || double.IsInfinity(availableSize.Height);
-                    break;
-                case Stretch.Uniform:
-                    deferCalculateTransform = double.IsInfinity(availableSize.Width) && double.IsInfinity(availableSize.Height);
-                    break;
-                case Stretch.None:
-                default:
-                    deferCalculateTransform = false;
-                    break;
-            }
-
-            if (deferCalculateTransform)
-            {
-                _calculateTransformOnArrange = true;
-                return DefiningGeometry?.Bounds.Size ?? Size.Empty;
-            }
-            else
-            {
-                _calculateTransformOnArrange = false;
-                return CalculateShapeSizeAndSetTransform(availableSize);
-            }
+            if (DefiningGeometry is null)
+            {
+                return default;
+            }
+
+            return CalculateSizeAndTransform(availableSize, DefiningGeometry.Bounds, Stretch).Item1;
         }

         protected override Size ArrangeOverride(Size finalSize)
-        {
-            if (_calculateTransformOnArrange)
-            {
-                _calculateTransformOnArrange = false;
-                CalculateShapeSizeAndSetTransform(finalSize);
-            }
-
-            return finalSize;
-        }
-
-        private Size CalculateShapeSizeAndSetTransform(Size availableSize)
         {
             if (DefiningGeometry != null)
             {
                 // This should probably use GetRenderBounds(strokeThickness) but then the calculations
                 // will multiply the stroke thickness as well, which isn't correct.
-                var (size, transform) = CalculateSizeAndTransform(availableSize, DefiningGeometry.Bounds, Stretch);
+                var (size, transform) = CalculateSizeAndTransform(finalSize, DefiningGeometry.Bounds, Stretch);

                 if (_transform != transform)
                 {


prevent window will close being called twice.

--- src/Avalonia.Native/WindowImplBase.cs
+++ src/Avalonia.Native/WindowImplBase.cs
@@ -18,6 +18,7 @@
     {
         IInputRoot _inputRoot;
         IAvnWindowBase _native;
+        bool _isClosed;
         private object _syncRoot = new object();
         private bool _deferredRendering = true;
         private readonly IMouseDevice _mouse;
@@ -110,7 +111,11 @@
                 _parent = parent;
             }

-            void IAvnWindowBaseEvents.Closed() => _parent.Closed?.Invoke();
+            void IAvnWindowBaseEvents.Closed()
+            {
+                _parent._isClosed = true;
+                _parent.Closed?.Invoke();
+            }

             void IAvnWindowBaseEvents.Activated() => _parent.Activated?.Invoke();

@@ -234,7 +239,11 @@

         public virtual void Dispose()
         {
-            _native.Close();
+            if (!_isClosed)
+            {
+                _native.Close();
+            }
+
             _native.Dispose();
             _native = null;


Upgraded ListMerger to version 3.1.0 compatibility.

--- src/BoboBrowse.Net/Util/ListMerger.cs
+++ src/BoboBrowse.Net/Util/ListMerger.cs
@@ -21,22 +21,26 @@
 //* please go to https://sourceforge.net/projects/bobo-browse/, or
 //* send mail to owner@browseengine.com.

+// Version compatibility level: 3.1.0
+// EXCEPTION: We are using object instead of string for the BrowseFacet.Value property.
 namespace BoboBrowse.Net.Util
 {
-    using System;
-    using System.Collections.Generic;
-    using System.Linq;
-    using Lucene.Net.Util;
     using BoboBrowse.Net.Facets.Impl;
     using BoboBrowse.Net.Search;
+    using Lucene.Net.Util;
+    using System;
+    using System.Collections;
+    using System.Collections.Generic;
+    using System.Globalization;
+    using System.Linq;

     public class ListMerger
     {
-        public class MergedIterator<T>
+        public class MergedIterator<T> : IEnumerator<T>
         {
             private class IteratorNode
             {
-                private readonly IEnumerator<T> iterator;
+                public IEnumerator<T> iterator;
                 public T CurVal;

                 public IteratorNode(IEnumerator<T> iterator)
@@ -73,27 +77,28 @@
                 }
             }

-            private readonly MergedQueue queue;
+            private readonly MergedQueue _queue;
+            private T _current;

             private MergedIterator(int length, IComparer<T> comparator)
             {
-                queue = new MergedQueue(length, comparator);
-            }
-
-            public MergedIterator(ICollection<IEnumerable<T>> iterators, IComparer<T> comparator)
-                : this(iterators.Count, comparator)
+                _queue = new MergedQueue(length, comparator);
+            }
+
+            public MergedIterator(IEnumerable<IEnumerator<T>> iterators, IComparer<T> comparator)
+                : this(iterators.Count(), comparator)
             {
                 foreach (IEnumerator<T> iterator in iterators)
                 {
                     IteratorNode ctx = new IteratorNode(iterator);
                     if (ctx.Fetch())
                     {
-                        queue.InsertWithOverflow(ctx);
-                    }
-                }
-            }
-
-            public MergedIterator(IEnumerable<T>[] iterators, IComparer<T> comparator)
+                        _queue.Add(ctx); // NOTE: This was InsertWithOverflow in codeplex version
+                    }
+                }
+            }
+
+            public MergedIterator(IEnumerator<T>[] iterators, IComparer<T> comparator)
                 : this(iterators.Length, comparator)
             {
                 foreach (IEnumerator<T> iterator in iterators)
@@ -101,32 +106,74 @@
                     IteratorNode ctx = new IteratorNode(iterator);
                     if (ctx.Fetch())
                     {
-                        queue.InsertWithOverflow(ctx);
-                    }
-                }
-            }
-
-            public virtual bool HasNext()
-            {
-                return queue.Size() > 0;
-            }
-
-            public virtual T Next()
-            {
-                IteratorNode ctx = (IteratorNode)queue.Top();
-                T val = ctx.CurVal;
-                if (ctx.Fetch())
-                {
-                    queue.UpdateTop();
+                        _queue.Add(ctx); // NOTE: This was InsertWithOverflow in codeplex version
+                    }
+                }
+            }
+
+            //public virtual bool HasNext()
+            //{
+            //    return queue.Size() > 0;
+            //}
+
+            //public virtual T Next()
+            //{
+            //    IteratorNode ctx = (IteratorNode)queue.Top();
+            //    T val = ctx.CurVal;
+            //    if (ctx.Fetch())
+            //    {
+            //        queue.UpdateTop();
+            //    }
+            //    else
+            //    {
+            //        queue.Pop();
+            //    }
+            //    return val;
+            //}
+
+            //public virtual void Remove()
+            //{
+            //    throw new NotSupportedException();
+            //}
+
+            public T Current
+            {
+                get { return _current; }
+            }
+
+            public void Dispose()
+            {
+            }
+
+            object IEnumerator.Current
+            {
+                get { return _current; }
+            }
+
+            public bool MoveNext()
+            {
+                if (_queue.Size() > 0)
+                {
+                    IteratorNode ctx = (IteratorNode)_queue.Top();
+                    T val = ctx.CurVal;
+                    if (ctx.Fetch())
+                    {
+                        _queue.UpdateTop();
+                    }
+                    else
+                    {
+                        _queue.Pop();
+                    }
+                    this._current = val;
+                    return true;
                 }
                 else
                 {
-                    queue.Pop();
-                }
-                return val;
-            }
-
-            public virtual void Remove()
+                    return false;
+                }
+            }
+
+            public void Reset()
             {
                 throw new NotSupportedException();
             }
@@ -136,129 +183,148 @@
         {
         }

-        public static MergedIterator<T> MergeLists<T>(IEnumerable<T>[] iterators, IComparer<T> comparator)
+        public static MergedIterator<T> MergeLists<T>(IEnumerator<T>[] iterators, IComparer<T> comparator)
         {
             return new MergedIterator<T>(iterators, comparator);
         }

-        public static MergedIterator<T> MergeLists<T>(ICollection<IEnumerable<T>> iterators, IComparer<T> comparator)
+        public static MergedIterator<T> MergeLists<T>(IEnumerable<IEnumerator<T>> iterators, IComparer<T> comparator)
         {
             return new MergedIterator<T>(iterators, comparator);
         }

-        public static List<T> MergeLists<T>(int offset, int count, IEnumerable<T>[] iterators, IComparer<T> comparator)
+        public static List<T> MergeLists<T>(int offset, int count, IEnumerator<T>[] iterators, IComparer<T> comparator)
         {
             return MergeLists(offset, count, new MergedIterator<T>(iterators, comparator));
         }

-        public static List<T> MergeLists<T>(int offset, int count, ICollection<IEnumerable<T>> iterators, IComparer<T> comparator)
+        public static List<T> MergeLists<T>(int offset, int count, IEnumerable<IEnumerator<T>> iterators, IComparer<T> comparator)
         {
             return MergeLists(offset, count, new MergedIterator<T>(iterators, comparator));
         }

         private static List<T> MergeLists<T>(int offset, int count, MergedIterator<T> mergedIter)
         {
-            for (int c = 0; c < offset && mergedIter.HasNext(); c++)
-            {
-                var x = mergedIter.Next();
+            for (int c = 0; c < offset && mergedIter.MoveNext(); c++)
+            {
+                var x = mergedIter.Current;
             }

             List<T> mergedList = new List<T>();

-            for (int c = 0; c < count && mergedIter.HasNext(); c++)
-            {
-                mergedList.Add(mergedIter.Next());
+            for (int c = 0; c < count && mergedIter.MoveNext(); c++)
+            {
+                mergedList.Add(mergedIter.Current);
             }

             return mergedList;
         }

-        public static IComparer<BrowseFacet> FACET_VAL_COMPARATOR = new MultiBoboBrowser.BrowseFacetValueComparator();
-
-        public static Dictionary<string, IFacetAccessible> MergeSimpleFacetContainers(ICollection<Dictionary<string, IFacetAccessible>> subMaps, BrowseRequest req)
-        {
-            Dictionary<string, Dictionary<object, BrowseFacet>> counts = new Dictionary<string, Dictionary<object, BrowseFacet>>();
-            foreach (Dictionary<string, IFacetAccessible> subMap in subMaps)
-            {
-                foreach (KeyValuePair<string, IFacetAccessible> entry in subMap)
-                {
-                    Dictionary<object, BrowseFacet> count = counts[entry.Key];
-                    if (count == null)
-                    {
-                        count = new Dictionary<object, BrowseFacet>();
-                        counts.Add(entry.Key, count);
-                    }
-                    foreach (BrowseFacet facet in entry.Value.GetFacets())
-                    {
-                        object val = facet.Value;
-                        BrowseFacet oldValue = count[val];
-                        if (oldValue == null)
+        public static IComparer<BrowseFacet> FACET_VAL_COMPARATOR = new FacetValComparator();
+
+        private class FacetValComparator : IComparer<BrowseFacet>
+        {
+            // FIXME: we need to reorganize all that stuff with comparators
+            private IComparer valueComparer = new Comparer(CultureInfo.InvariantCulture);
+
+            public int Compare(BrowseFacet o1, BrowseFacet o2)
+            {
+                return valueComparer.Compare(o1.Value, o2.Value);
+
+                //// NOTE: In this version we don't have to do it this way because the
+                //// values are stored in type object in the BrowseFacet.
+                //int ret = o1.Value.CompareTo(o2.Value);
+                //if (o1.getValue().startsWith("-") && o2.getValue().startsWith("-")) {
+                //    ret =-ret;
+                //}
+                //return ret;
+            }
+
+            public static IDictionary<string, IFacetAccessible> MergeSimpleFacetContainers(IEnumerable<IDictionary<string, IFacetAccessible>> subMaps, BrowseRequest req)
+            {
+                Dictionary<string, Dictionary<object, BrowseFacet>> counts = new Dictionary<string, Dictionary<object, BrowseFacet>>();
+                foreach (Dictionary<string, IFacetAccessible> subMap in subMaps)
+                {
+                    foreach (KeyValuePair<string, IFacetAccessible> entry in subMap)
+                    {
+                        Dictionary<object, BrowseFacet> count = counts[entry.Key];
+                        if (count == null)
                         {
-                            count.Add(val, new BrowseFacet(val, facet.HitCount));
+                            count = new Dictionary<object, BrowseFacet>();
+                            counts.Add(entry.Key, count);
                         }
-                        else
+                        foreach (BrowseFacet facet in entry.Value.GetFacets())
                         {
-                            oldValue.HitCount = oldValue.HitCount + facet.HitCount;
+                            object val = facet.Value;
+                            BrowseFacet oldValue = count[val];
+                            if (oldValue == null)
+                            {
+                                count.Add(val, new BrowseFacet(val, facet.HitCount));
+                            }
+                            else
+                            {
+                                oldValue.HitCount = oldValue.HitCount + facet.HitCount;
+                            }
                         }
                     }
                 }
-            }
-
-            Dictionary<string, IFacetAccessible> mergedFacetMap = new Dictionary<string, IFacetAccessible>();
-
-            foreach (string facet in counts.Keys)
-            {
-                FacetSpec fs = req.GetFacetSpec(facet);
-
-                FacetSpec.FacetSortSpec sortSpec = fs.OrderBy;
-
-                IComparer<BrowseFacet> comparator;
-                if (FacetSpec.FacetSortSpec.OrderValueAsc.Equals(sortSpec))
-                {
-                    comparator = FACET_VAL_COMPARATOR;
-                }
-                else if (FacetSpec.FacetSortSpec.OrderHitsDesc.Equals(sortSpec))
-                {
-                    comparator = FacetHitcountComparatorFactory.FACET_HITS_COMPARATOR;
-                }
-                else
-                {
-                    comparator = fs.CustomComparatorFactory.NewComparator();
-                }
-
-                Dictionary<object, BrowseFacet> facetValueCounts = counts[facet];
-                BrowseFacet[] facetArray = facetValueCounts.Values.ToArray();
-                System.Array.Sort(facetArray, comparator);
-
-                int numToShow = facetArray.Length;
-                if (req != null)
-                {
-                    FacetSpec fspec = req.GetFacetSpec(facet);
-                    if (fspec != null)
-                    {
-                        int maxCount = fspec.MaxCount;
-                        if (maxCount > 0)
+
+                Dictionary<string, IFacetAccessible> mergedFacetMap = new Dictionary<string, IFacetAccessible>();
+
+                foreach (string facet in counts.Keys)
+                {
+                    FacetSpec fs = req.GetFacetSpec(facet);
+
+                    FacetSpec.FacetSortSpec sortSpec = fs.OrderBy;
+
+                    IComparer<BrowseFacet> comparator;
+                    if (FacetSpec.FacetSortSpec.OrderValueAsc.Equals(sortSpec))
+                    {
+                        comparator = FACET_VAL_COMPARATOR;
+                    }
+                    else if (FacetSpec.FacetSortSpec.OrderHitsDesc.Equals(sortSpec))
+                    {
+                        comparator = FacetHitcountComparatorFactory.FACET_HITS_COMPARATOR;
+                    }
+                    else
+                    {
+                        comparator = fs.CustomComparatorFactory.NewComparator();
+                    }
+
+                    Dictionary<object, BrowseFacet> facetValueCounts = counts[facet];
+                    BrowseFacet[] facetArray = facetValueCounts.Values.ToArray();
+                    Array.Sort(facetArray, comparator);
+
+                    int numToShow = facetArray.Length;
+                    if (req != null)
+                    {
+                        FacetSpec fspec = req.GetFacetSpec(facet);
+                        if (fspec != null)
                         {
-                            numToShow = Math.Min(maxCount, numToShow);
+                            int maxCount = fspec.MaxCount;
+                            if (maxCount > 0)
+                            {
+                                numToShow = Math.Min(maxCount, numToShow);
+                            }
                         }
                     }
-                }
-
-                BrowseFacet[] facets;
-                if (numToShow == facetArray.Length)
-                {
-                    facets = facetArray;
-                }
-                else
-                {
-                    facets = new BrowseFacet[numToShow];
-                    System.Array.Copy(facetArray, 0, facets, 0, numToShow);
-                }
-
-                MappedFacetAccessible mergedFacetAccessible = new MappedFacetAccessible(facets);
-                mergedFacetMap.Add(facet, mergedFacetAccessible);
-            }
-            return mergedFacetMap;
+
+                    BrowseFacet[] facets;
+                    if (numToShow == facetArray.Length)
+                    {
+                        facets = facetArray;
+                    }
+                    else
+                    {
+                        facets = new BrowseFacet[numToShow];
+                        Array.Copy(facetArray, 0, facets, 0, numToShow);
+                    }
+
+                    MappedFacetAccessible mergedFacetAccessible = new MappedFacetAccessible(facets);
+                    mergedFacetMap.Add(facet, mergedFacetAccessible);
+                }
+                return mergedFacetMap;
+            }
         }
     }
 }


Drafting first methods

Drafting first methods

--- src/CommandLine/UnParserExtensions.cs
+++ src/CommandLine/UnParserExtensions.cs
@@ -3,11 +3,50 @@
 using System;
 using System.Collections.Generic;
 using System.Linq;
+using System.Reflection;
 using System.Text;
+using CommandLine.Core;
+using CommandLine.Infrastructure;
+using CommandLine.Text; // TODO: move down StringBuilderExtensions type
+using CSharpx;

 namespace CommandLine
 {
+    /// <summary>
+    /// Defines overloads to unparse options instance.
+    /// </summary>
     public static class UnParserExtensions
     {
+        public static string FormatCommandLine<T>(T options)
+        {
+            var specs = options.GetType().GetSpecifications(pi =>
+                Tuple.Create(Specification.FromProperty(pi),
+                pi.GetValue(options, null)));
+            var optSpecs = specs.OfType<Tuple<OptionSpecification, object>>();
+            var valSpecs = specs.OfType<Tuple<ValueSpecification, object>>().OrderBy(v => v.Item1.Index);
+
+            var builder = new StringBuilder();
+            optSpecs.ForEach(opt => builder.Append(FormatOption(opt)).Append(' '));
+            builder.Remove(0, builder.Length);
+            //value
+
+            return builder.ToString();
+        }
+
+        private static string FormatOption(Tuple<OptionSpecification, object> optionSpec)
+        {
+            var spec = optionSpec.Item1;
+            var value = optionSpec.Item2;
+            return new StringBuilder()
+                    .Append(spec.FormatName())
+                    .Append(' ')
+                    .Append(value)
+                      .ToString();
+        }
+
+        private static string FormatName(this OptionSpecification optionSpec)
+        {
+            return optionSpec.LongName.Length > 0 ? "--".JoinTo(optionSpec.LongName) : "-".JoinTo(optionSpec.ShortName);
+        }
     }
 }


Cleanup unnecessary null check

Cleanup unnecessary null check

--- src/Couchbase.Lite.Shared/Database.cs
+++ src/Couchbase.Lite.Shared/Database.cs
@@ -342,16 +342,10 @@
             }

             var unsavedDoc = UnsavedRevisionDocumentCache.Get(id);
-            Document doc = ((unsavedDoc != null && unsavedDoc.Target != null)
-                ? (Document)unsavedDoc.Target : DocumentCache.Get(id));
-
+            Document doc = unsavedDoc == null ? unsavedDoc.Target as Document : DocumentCache.Get(id);
             if (doc == null)
             {
                 doc = new Document(this, id);
-                if (doc == null)
-                {
-                    return null;
-                }
                 DocumentCache[id] = doc;
                 UnsavedRevisionDocumentCache[id] = new WeakReference(doc);
             }


Fixed tests about ObjectTrackingEnable and DeferredLoadingEnabled

git-svn-id: 1800f71f313d917366f95485fa960eed04b40598@1045 33146b6e-df29-0410-a1ca-39be37fb9416

--- src/DbLinq/Test/Providers/ReadTest.cs
+++ src/DbLinq/Test/Providers/ReadTest.cs
@@ -340,9 +340,8 @@
             Northwind db = CreateDB();
             var q = from t in db.Territories
                     select t;
-            var employeeCount = q.Count();
+            var employeeCount = q.FirstOrDefault();
             db.ObjectTrackingEnabled = false;
-            Assert.AreEqual(4, employeeCount, "Expected for employees, got count=" + employeeCount);
         }

         [Test]
@@ -352,9 +351,8 @@
             Northwind db = CreateDB();
             var q = from t in db.Territories
                     select t;
-            var employeeCount = q.Count();
+            var employeeCount = q.FirstOrDefault();
             db.DeferredLoadingEnabled = false;
-            Assert.AreEqual(4, employeeCount, "Expected for employees, got count=" + employeeCount);
         }

         [Test]


Fixed internal access violation check due to direct call of GCHandle.Alloc

--- numpy/NumpyDotNet/NumericOps.cs
+++ numpy/NumpyDotNet/NumericOps.cs
@@ -1362,7 +1362,7 @@
             Object a = NpyCoreApi.GCHandleFromIntPtr(aPtr).Target;
             Object b = NpyCoreApi.GCHandleFromIntPtr(bPtr).Target;
             Object r = site.Target(site, a, b);
-            return GCHandle.ToIntPtr(GCHandle.Alloc(r));
+            return GCHandle.ToIntPtr(NpyCoreApi.AllocGCHandle(r));
         }
         [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
         internal delegate IntPtr del_GenericBinOp(IntPtr a, IntPtr b);


Fix log message in RemoteRenderer

Fix log message in RemoteRenderer

--- src/Components/Server/src/Circuits/RemoteRenderer.cs
+++ src/Components/Server/src/Circuits/RemoteRenderer.cs
@@ -209,7 +209,7 @@
             else
             {
                 var message = $"Completing batch {entry.BatchId} " +
-                    errorMessageOrNull == null ? "without error." : "with error.";
+                    (errorMessageOrNull == null ? "without error." : "with error.");

                 _logger.LogDebug(message);
                 CompleteRender(entry.CompletionSource, errorMessageOrNull);


Forgot to fix a line from when I reverted the ConvertToHex method

--- src/Couchbase.Lite.Shared/Store/ForestDBViewStore.cs
+++ src/Couchbase.Lite.Shared/Store/ForestDBViewStore.cs
@@ -235,7 +235,7 @@
                     if(IsLegalChar(buffer[0])) {
                         sb.Append(*currentCharPtr);
                     } else {
-                        sb.AppendFormat("@{0}", Misc.ConvertToHex(buffer, bytesWritten));
+                        sb.AppendFormat("@{0}", Misc.ConvertToHex(buffer));
                     }

                     currentCharPtr++;


Fixes sequence validation error when both enable Challenge and Auth of dashboard authentication. #1097

--- src/DotNetCore.CAP.Dashboard/CAP.BuilderExtension.cs
+++ src/DotNetCore.CAP.Dashboard/CAP.BuilderExtension.cs
@@ -111,6 +111,16 @@

         internal static async Task<bool> Authentication(HttpContext context, DashboardOptions options)
         {
+            var isAuthenticated = context.User?.Identity?.IsAuthenticated;
+
+            if (isAuthenticated == false && options.UseChallengeOnAuth)
+            {
+                await context.ChallengeAsync(options.DefaultChallengeScheme);
+                await context.Response.CompleteAsync();
+
+                return false;
+            }
+
             if (options.UseAuth)
             {
                 var result = await context.AuthenticateAsync(options.DefaultAuthenticationScheme);
@@ -125,16 +135,7 @@
                 }
             }

-            var isAuthenticated = context.User?.Identity?.IsAuthenticated;
-
-            if (isAuthenticated == false && options.UseChallengeOnAuth)
-            {
-                await context.ChallengeAsync(options.DefaultChallengeScheme);
-                await context.Response.CompleteAsync();
-                return false;
-            }
-
             return true;
-        }
+        }
     }
 }


fixed Events attached properties

fixed Events attached properties

--- src/DotVVM.Framework/Binding/ActiveDotvvmProperty.cs
+++ src/DotVVM.Framework/Binding/ActiveDotvvmProperty.cs
@@ -15,9 +15,8 @@

         public static ActiveDotvvmProperty RegisterCommandToAttribute<TDeclaringType>(string name, string attributeName)
         {
-            return DelegateActionProperty<object>.Register<TDeclaringType>(name, (writer, context, value, control) =>
+            return DelegateActionProperty<ICommandBinding>.Register<TDeclaringType>(name, (writer, context, binding, control) =>
             {
-                var binding = value as ICommandBinding;
                 var script = KnockoutHelper.GenerateClientPostBackScript(name, binding, context, control);
                 writer.AddAttribute(attributeName, script);
             });


inlined: TryEmitBlock and optimized the use of BlockInfo

changed: Made CompileSys public to be used in tests

--- src/FastExpressionCompiler/FastExpressionCompiler.cs
+++ src/FastExpressionCompiler/FastExpressionCompiler.cs
@@ -61,7 +61,8 @@
         public static Delegate CompileFast(this LambdaExpression lambdaExpr, bool ifFastFailedReturnNull = false) =>
             lambdaExpr.CompileFast<Delegate>(ifFastFailedReturnNull);

-        private static TDelegate CompileSys<TDelegate>(this Expression<TDelegate> lambdaExpr) where TDelegate : class =>
+        /// <summary>Unifies Compile for System.Linq.Expressions and FEC.LightExpression</summary>
+        public static TDelegate CompileSys<TDelegate>(this Expression<TDelegate> lambdaExpr) where TDelegate : class =>
             lambdaExpr
 #if LIGHT_EXPRESSION
             .ToLambdaExpression()
@@ -1244,7 +1245,24 @@
                         return TryEmitAssign((BinaryExpression)expr, paramExprs, il, ref closure, parent);

                     case ExpressionType.Block:
-                        return TryEmitBlock((BlockExpression)expr, paramExprs, il, ref closure, parent);
+                        var blockExpr = (BlockExpression)expr;
+                        var blockHasVars = blockExpr.Variables.Count != 0;
+                        if (blockHasVars)
+                            closure.PushBlockAndConstructLocalVars(blockExpr.Variables, il);
+
+                        // ignore result for all not the last statements in block
+                        var exprs = blockExpr.Expressions;
+                        for (var i = 0; i < exprs.Count - 1; i++)
+                            if (!TryEmit(exprs[i], paramExprs, il, ref closure, parent | ParentFlags.IgnoreResult))
+                                return false;
+
+                        // last (result) statement in block will provide the result
+                        if (!TryEmit(blockExpr.Result, paramExprs, il, ref closure, parent))
+                            return false;
+
+                        if (blockHasVars)
+                            closure.PopBlock();
+                        return true;

                     case ExpressionType.Try:
                         return TryEmitTryCatchFinallyBlock((TryExpression)expr, paramExprs, il, ref closure, parent);
@@ -1448,21 +1466,6 @@
                 return true;
             }

-            private static bool TryEmitBlock(BlockExpression blockExpr,
-                IReadOnlyList<ParameterExpression> paramExprs, ILGenerator il, ref ClosureInfo closure, ParentFlags parent)
-            {
-                closure.PushBlockAndConstructLocalVars(blockExpr.Variables, il);
-
-                var exprs = blockExpr.Expressions;
-                var last = exprs.Count - 1;
-                for (var i = 0; i <= last; i++)
-                    if (!TryEmit(exprs[i], paramExprs, il, ref closure,
-                        i < last ? parent | ParentFlags.IgnoreResult : parent))
-                        return false;
-
-                closure.PopBlock();
-                return true;
-            }

             private static bool TryEmitTryCatchFinallyBlock(TryExpression tryExpr,
                 IReadOnlyList<ParameterExpression> paramExprs, ILGenerator il, ref ClosureInfo closure, ParentFlags parent)
@@ -1583,9 +1586,7 @@
                 var variable = closure.GetDefinedLocalVarOrDefault(paramExpr);
                 if (variable != null)
                 {
-                    if ((paramType.IsValueType() && (parent & ParentFlags.MemberAccess) != 0))
-                        il.Emit(OpCodes.Ldloca_S, variable);
-                    else if (byRefIndex >= 0)
+                    if (byRefIndex != -1 || (paramType.IsValueType() && (parent & ParentFlags.MemberAccess) != 0))
                         il.Emit(OpCodes.Ldloca_S, variable);
                     else
                         il.Emit(OpCodes.Ldloc, variable);
@@ -2369,20 +2370,20 @@
                 IReadOnlyList<Expression> argExprs = expr.Arguments;
                 if (argExprs.Count != 0)
                 {
+                    var args = expr.Method.GetParameters();
                     for (var i = 0; i < argExprs.Count; i++)
                     {
-                        var callParameters = expr.Method.GetParameters();
-                        var byRefIndex = callParameters[i].ParameterType.IsByRef ? i : -1;
-                        if (!TryEmit(argExprs[i], paramExprs, il, ref closure, callFlags, byRefIndex))
+                        var byRefIndex = args[i].ParameterType.IsByRef ? i : -1;
+                        if (!TryEmit(argExprs[i], paramExprs, il, ref closure, callFlags,
+                            byRefIndex))
                             return false;
                     }
                 }

-                var method = expr.Method;
-                if (method.IsVirtual && objExpr?.Type.IsValueType() == true)
+                if (expr.Method.IsVirtual && objExpr?.Type.IsValueType() == true)
                     il.Emit(OpCodes.Constrained, objExpr.Type);

-                return EmitMethodCall(il, method, parent);
+                return EmitMethodCall(il, expr.Method, parent);
             }

             private static bool TryEmitMemberAccess(MemberExpression expr,


using LiveCountArray for tracking the block stack

--- src/FastExpressionCompiler/FastExpressionCompiler.cs
+++ src/FastExpressionCompiler/FastExpressionCompiler.cs
@@ -288,7 +288,7 @@

             // Promote found constants and nested lambdas into outer closure
             var nestedConstants = nestedInfo.Constants;
-            for (var i = 0; i < nestedConstants.Length; i++)
+            for (var i = 0; i < nestedConstants.Count; i++)
                 info.AddConstant(nestedConstants.Items[i]);

             // Add nested constants to outer lambda closure.
@@ -358,23 +358,23 @@
         {
             private const int EXPAND_BY = 3;

-            public int Length;
+            public int Count;
             public T[] Items;

             public LiveCountArray(T[] items)
             {
                 Items = items;
-                Length = items.Length;
+                Count = items.Length;
             }

             public ref T PushSlot()
             {
-                if (++Length >= Items.Length)
+                if (++Count >= Items.Length)
                     Items = Expand(Items);
-                return ref Items[Length - 1];
-            }
-
-            public void Pop() => --Length;
+                return ref Items[Count - 1];
+            }
+
+            public void Pop() => --Count;

             private static T[] Expand(T[] items)
             {
@@ -405,9 +405,8 @@
             private int[] _tryCatchFinallyInfos;
             public int CurrentTryCatchFinallyIndex;

-            // Helper to decide whether we are inside the block or not
-            private BlockInfo[] _blockStack;
-            private int TopBlockIndex;
+            // Tracks the stack of blocks where are we in emit phase
+            private LiveCountArray<BlockInfo> _blockStack;

             // Dictionary for the used Labels in IL
             private KeyValuePair<LabelTarget, Label?>[] _labels;
@@ -435,7 +434,7 @@
             // All nested lambdas recursively nested in expression
             public NestedLambdaInfo[] NestedLambdas;

-            public int ClosedItemCount => Constants.Length + NonPassedParameters.Length + NestedLambdas.Length;
+            public int ClosedItemCount => Constants.Count + NonPassedParameters.Length + NestedLambdas.Length;

             #endregion

@@ -449,8 +448,7 @@
                 CurrentTryCatchFinallyIndex = -1;
                 _tryCatchFinallyInfos = null;
                 _labels = null;
-                _blockStack = Tools.Empty<BlockInfo>();
-                TopBlockIndex = -1;
+                _blockStack = new LiveCountArray<BlockInfo>(Tools.Empty<BlockInfo>());

                 if (userProvidedClosure == null)
                 {
@@ -479,7 +477,7 @@
             {
                 Status |= ClosureStatus.HasClosure;

-                var i = Constants.Length - 1;
+                var i = Constants.Count - 1;
                 while (i != -1 && !ReferenceEquals(Constants.Items[i], expr)) --i;
                 if (i == -1)
                 {
@@ -593,7 +591,7 @@
                 var nonPassedParams = NonPassedParameters;
                 var nestedLambdas = NestedLambdas;

-                var constPlusParamCount = constants.Length + nonPassedParams.Length;
+                var constPlusParamCount = constants.Count + nonPassedParams.Length;
                 var totalItemCount = constPlusParamCount + nestedLambdas.Length;

                 // Construct the array based closure when number of values is bigger than
@@ -604,13 +602,13 @@

                 // Construct the Closure Type and optionally Closure object with closed values stored as fields:
                 var fieldTypes = new Type[totalItemCount];
-                if (constants.Length != 0)
-                    for (var i = 0; i < constants.Length; i++)
+                if (constants.Count != 0)
+                    for (var i = 0; i < constants.Count; i++)
                         fieldTypes[i] = constants.Items[i].Type;

                 if (nonPassedParams.Length != 0)
                     for (var i = 0; i < nonPassedParams.Length; i++)
-                        fieldTypes[constants.Length + i] = nonPassedParams[i].Type;
+                        fieldTypes[constants.Count + i] = nonPassedParams[i].Type;

                 if (nestedLambdas.Length != 0)
                     for (var i = 0; i < nestedLambdas.Length; i++)
@@ -632,7 +630,7 @@
                 var nonPassedParams = NonPassedParameters;
                 var nestedLambdas = NestedLambdas;

-                var constPlusParamCount = constants.Length + nonPassedParams.Length;
+                var constPlusParamCount = constants.Count + nonPassedParams.Length;
                 var totalItemCount = constPlusParamCount + nestedLambdas.Length;

                 // Construct the array based closure when number of values is bigger than
@@ -641,8 +639,8 @@
                 if (totalItemCount > createMethods.Length)
                 {
                     var items = new object[totalItemCount];
-                    if (constants.Length != 0)
-                        for (var i = 0; i < constants.Length; i++)
+                    if (constants.Count != 0)
+                        for (var i = 0; i < constants.Count; i++)
                             items[i] = constants.Items[i].Value;

                     // skip non passed parameters as it is only for nested lambdas
@@ -659,7 +657,7 @@
                 var fieldTypes = new Type[totalItemCount];
                 var fieldValues = new object[totalItemCount];

-                for (var i = 0; i < constants.Length; i++)
+                for (var i = 0; i < constants.Count; i++)
                 {
                     var constantExpr = constants.Items[i];
                     if (constantExpr != null)
@@ -670,7 +668,7 @@
                 }

                 for (var i = 0; i < nonPassedParams.Length; i++)
-                    fieldTypes[constants.Length + i] = nonPassedParams[i].Type;
+                    fieldTypes[constants.Count + i] = nonPassedParams[i].Type;

                 for (var i = 0; i < nestedLambdas.Length; i++)
                 {
@@ -703,10 +701,7 @@
             /// LocalVar maybe a `null` in collecting phase when we only need to decide if ParameterExpression is an actual parameter or variable
             public void PushBlockWithVars(ParameterExpression blockVarExpr, LocalBuilder localVar = null)
             {
-                if (++TopBlockIndex >= _blockStack.Length)
-                    _blockStack = ExpandBlockStack(_blockStack);
-
-                ref var block = ref _blockStack[TopBlockIndex];
+                ref var block = ref _blockStack.PushSlot();
                 block.VarExprs = blockVarExpr;
                 block.LocalVars = localVar;
             }
@@ -714,10 +709,7 @@
             /// LocalVars maybe a `null` in collecting phase when we only need to decide if ParameterExpression is an actual parameter or variable
             public void PushBlockWithVars(IReadOnlyList<ParameterExpression> blockVarExprs, LocalBuilder[] localVars = null)
             {
-                if (++TopBlockIndex >= _blockStack.Length)
-                    _blockStack = ExpandBlockStack(_blockStack);
-
-                ref var block = ref _blockStack[TopBlockIndex];
+                ref var block = ref _blockStack.PushSlot();
                 block.VarExprs = blockVarExprs;
                 block.LocalVars = localVars;
             }
@@ -731,14 +723,13 @@
                 PushBlockWithVars(blockVarExprs, localVars);
             }

-            public void PopBlock() =>
-                --TopBlockIndex;
+            public void PopBlock() => _blockStack.Pop();

             public bool IsLocalVar(object varParamExpr)
             {
-                for (var i = TopBlockIndex; i > -1; --i)
-                {
-                    var varExprObj = _blockStack[i].VarExprs;
+                for (var i = _blockStack.Count - 1; i > -1; --i)
+                {
+                    var varExprObj = _blockStack.Items[i].VarExprs;
                     if (ReferenceEquals(varExprObj, varParamExpr))
                         return true;

@@ -753,9 +744,9 @@

             public LocalBuilder GetDefinedLocalVarOrDefault(ParameterExpression varParamExpr)
             {
-                for (var i = TopBlockIndex; i > -1; --i)
-                {
-                    ref var block = ref _blockStack[i];
+                for (var i = _blockStack.Count - 1; i > -1; --i)
+                {
+                    ref var block = ref _blockStack.Items[i];
                     var varExprObj = block.VarExprs;

                     if (ReferenceEquals(varExprObj, varParamExpr))
@@ -2070,7 +2061,7 @@
                 if (nonPassedParamIndex == -1)
                     return false; // what??? no chance

-                var closureItemIndex = closure.Constants.Length + nonPassedParamIndex;
+                var closureItemIndex = closure.Constants.Count + nonPassedParamIndex;
                 return LoadClosureFieldOrItem(ref closure, il, closureItemIndex, paramType);
             }

@@ -2420,7 +2411,7 @@
                 {
                     var closureConstants = closure.Constants;

-                    var constIndex = closureConstants.Length - 1;
+                    var constIndex = closureConstants.Count - 1;
                     while (constIndex >= 0 && !ReferenceEquals(closureConstants.Items[constIndex], expr))
                         --constIndex;

@@ -2997,7 +2988,7 @@
                         if (nonPassedParamIndex == -1)
                             return false; // what??? no chance

-                        var paramInClosureIndex = closure.Constants.Length + nonPassedParamIndex;
+                        var paramInClosureIndex = closure.Constants.Count + nonPassedParamIndex;

                         il.Emit(OpCodes.Ldarg_0); // closure is always a first argument

@@ -3286,7 +3277,7 @@
                 var outerNonPassedParams = closure.NonPassedParameters;

                 // Load compiled lambda on stack counting the offset
-                outerNestedLambdaIndex += outerConstants.Length + outerNonPassedParams.Length;
+                outerNestedLambdaIndex += outerConstants.Count + outerNonPassedParams.Length;

                 if (!LoadClosureFieldOrItem(ref closure, il, outerNestedLambdaIndex, nestedLambda.GetType()))
                     return false;
@@ -3306,14 +3297,14 @@

                 // Load constants on stack
                 var nestedConstants = nestedClosureInfo.Constants;
-                if (nestedConstants.Length != 0)
-                {
-                    for (var nestedConstIndex = 0; nestedConstIndex < nestedConstants.Length; nestedConstIndex++)
+                if (nestedConstants.Count != 0)
+                {
+                    for (var nestedConstIndex = 0; nestedConstIndex < nestedConstants.Count; nestedConstIndex++)
                     {
                         var nestedConstant = nestedConstants.Items[nestedConstIndex];

                         // Find constant index in the outer closure
-                        var outerConstIndex = outerConstants.Length - 1;
+                        var outerConstIndex = outerConstants.Count - 1;
                         while (outerConstIndex != -1 && !ReferenceEquals(outerConstants.Items[outerConstIndex], nestedConstant))
                             --outerConstIndex;
                         if (outerConstIndex == -1)
@@ -3352,7 +3343,7 @@

                         // Duplicate nested array on stack to store the item, and load index to where to store
                         il.Emit(OpCodes.Dup);
-                        EmitLoadConstantInt(il, nestedConstants.Length + nestedParamIndex);
+                        EmitLoadConstantInt(il, nestedConstants.Count + nestedParamIndex);
                     }

                     var paramIndex = paramExprs.Count - 1;
@@ -3378,7 +3369,7 @@
                         {
                             var outerParamIndex = outerNonPassedParams.GetFirstIndex(nestedUsedParam);
                             if (outerParamIndex == -1 ||
-                                !LoadClosureFieldOrItem(ref closure, il, outerConstants.Length + outerParamIndex,
+                                !LoadClosureFieldOrItem(ref closure, il, outerConstants.Count + outerParamIndex,
                                     nestedUsedParamType, nestedUsedParam))
                                 return false;
                         }
@@ -3415,10 +3406,10 @@
                         if (isNestedArrayClosure)
                         {
                             il.Emit(OpCodes.Dup);
-                            EmitLoadConstantInt(il, nestedConstants.Length + nestedNonPassedParams.Length + nestedLambdaIndex);
+                            EmitLoadConstantInt(il, nestedConstants.Count + nestedNonPassedParams.Length + nestedLambdaIndex);
                         }

-                        outerLambdaIndex += outerConstants.Length + outerNonPassedParams.Length;
+                        outerLambdaIndex += outerConstants.Count + outerNonPassedParams.Length;

                         var nestedNestedLambdaType = nestedNestedLambda.Lambda.GetType();
                         if (!LoadClosureFieldOrItem(ref closure, il, outerLambdaIndex, nestedNestedLambdaType))


fix bug.

fix bug.

--- src/ENode/Commanding/CommandResult.cs
+++ src/ENode/Commanding/CommandResult.cs
@@ -62,7 +62,7 @@
                 throw new ArgumentNullException("exception");
             }
             Status = CommandResultStatus.Failed;
-            ErrorMessage = exception.Message;
+            ErrorMessage = errorMessage;
             Exception = exception;
         }
     }


Build error post refactoring..

Build error post refactoring..

--- src/Firestorm.EntityFramework6/EntitiesDataSource.cs
+++ src/Firestorm.EntityFramework6/EntitiesDataSource.cs
@@ -27,7 +27,7 @@
             return new EntitiesRepository<TEntity>(repo);
         }

-        public IEnumerable<Type> FindRespositoryTypes()
+        public IEnumerable<Type> FindRepositoryTypes()
         {
             using (var context = new TDbContext())
             {


upgrade version to 2.0.7

upgrade version to 2.0.7

--- src/EQueue/Properties/AssemblyInfo.cs
+++ src/EQueue/Properties/AssemblyInfo.cs
@@ -32,5 +32,5 @@
 // 可以指定所有这些值，也可以使用“生成号”和“修订号”的默认值，
 // 方法是按如下所示使用“*”:
 // [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("2.0.6")]
-[assembly: AssemblyFileVersion("2.0.6")]
+[assembly: AssemblyVersion("2.0.7")]
+[assembly: AssemblyFileVersion("2.0.7")]


Mark static member `readonly` as it should never be reassigned.

--- src/Fixie.VisualStudio.TestAdapter/VsTestExecutor.cs
+++ src/Fixie.VisualStudio.TestAdapter/VsTestExecutor.cs
@@ -14,7 +14,7 @@
     public class VsTestExecutor : ITestExecutor
     {
         public const string Id = "executor://Fixie.VisualStudio";
-        public static Uri Uri = new Uri(Id);
+        public static readonly Uri Uri = new Uri(Id);

         /// <summary>
         /// Called by Visual Studio, when running all tests.


Delete ITransport.cs

Delete ITransport.cs

--- src/ElasticsearchClient/ITransport.cs
+++ src/ElasticsearchClient/ITransport.cs
@@ -1,8 +0,0 @@
-namespace Elasticsearch.Client
-{
-    // This project can output the Class library as a NuGet Package.
-    // To enable this option, right-click on the project and select the Properties menu item. In the Build tab select "Produce outputs on build".
-    public interface ITransport
-    {
-    }
-}


Revert to using a lock statement

Revert to using a lock statement

--- src/Ensconce.Update/NDjangoWrapper.cs
+++ src/Ensconce.Update/NDjangoWrapper.cs
@@ -1,7 +1,6 @@
 using Ensconce.NDjango.Core;
 using System;
 using System.IO;
-using System.Threading;

 namespace Ensconce.Update
 {
@@ -9,7 +8,6 @@
     {
         private const string StringProvider = "ensconceString://";
         private static readonly ErrorTemplate Error = new ErrorTemplate();
-        private static readonly Mutex ErrorMutex = new Mutex(false, "EnsconceError");
         private static readonly Lazy<Interfaces.ITemplateManager> TemplateManager = new Lazy<Interfaces.ITemplateManager>(() => GetTemplateManager(false));
         private static readonly Lazy<Interfaces.ITemplateManager> XmlTemplateManager = new Lazy<Interfaces.ITemplateManager>(() => GetTemplateManager(true));

@@ -29,27 +27,19 @@

         public static string RenderTemplate(this string template, Lazy<TagDictionary> values)
         {
-            try
-            {
-                ErrorMutex.WaitOne();
-                return Render(template, values, TemplateManager.Value);
-            }
-            finally
-            {
-                ErrorMutex.ReleaseMutex();
-            }
+            return RenderLocked(template, values, TemplateManager.Value);
         }

         public static string RenderXmlTemplate(this string template, Lazy<TagDictionary> values)
         {
-            try
+            return RenderLocked(template, values, XmlTemplateManager.Value);
+        }
+
+        private static string RenderLocked(string template, Lazy<TagDictionary> values, Interfaces.ITemplateManager templateManager)
+        {
+            lock (Error)
             {
-                ErrorMutex.WaitOne();
-                return Render(template, values, XmlTemplateManager.Value);
-            }
-            finally
-            {
-                ErrorMutex.ReleaseMutex();
+                return Render(template, values, templateManager);
             }
         }


Handle native context classes correctly by printing its internal definition.

--- src/Generator/Generators/CSharp/CSharpTypePrinter.cs
+++ src/Generator/Generators/CSharp/CSharpTypePrinter.cs
@@ -305,7 +305,12 @@

         public CSharpTypePrinterResult VisitClassDecl(Class @class)
         {
-            return GetNestedQualifiedName(@class);
+            var nestedName = GetNestedQualifiedName(@class);
+
+            if (ContextKind == CSharpTypePrinterContextKind.Native)
+                return string.Format("{0}.Internal", nestedName);
+
+            return nestedName;
         }

         public CSharpTypePrinterResult VisitFieldDecl(Field field)


remove debug msgs

remove debug msgs

svn path=/trunk/; revision=3603

--- src/Extensions/ComplexMenuItemNode.cs
+++ src/Extensions/ComplexMenuItemNode.cs
@@ -29,7 +29,6 @@

 		public override Gtk.MenuItem GetMenuItem ()
 		{
-			Console.WriteLine ("POOOOOOOOOOONG");
 			ComplexMenuItem item = System.Activator.CreateInstance (Type.GetType (widget_type)) as ComplexMenuItem;
 			cmd = (ICommand) Addin.CreateInstance (command_type);


Adding null checks

Adding null checks

--- src/GitHub.InlineReviews/Tags/InlineCommentTagger.cs
+++ src/GitHub.InlineReviews/Tags/InlineCommentTagger.cs
@@ -95,12 +95,11 @@
                     Dictionary<int, InlineAnnotationModel[]> spanAnnotationsByLine = null;
                     if (side == DiffSide.Right)
                     {
-                        var spanAnnotations = file.InlineAnnotations.Where(x =>
+                        var spanAnnotations = file.InlineAnnotations?.Where(x =>
                                 x.EndLine - 1 >= startLine &&
                                 x.EndLine - 1 <= endLine);

-                        spanAnnotationsByLine = spanAnnotations
-                            .GroupBy(model => model.EndLine)
+                        spanAnnotationsByLine = spanAnnotations?.GroupBy(model => model.EndLine)
                             .ToDictionary(models => models.Key - 1, models => models.ToArray());
                     }


Dedent a line in ExpressionConverters.cs

--- src/Flame.Ecs/ExpressionConverters.cs
+++ src/Flame.Ecs/ExpressionConverters.cs
@@ -1489,7 +1489,7 @@
                                     loc.CreateDiagnosticsNode(),
                                     fieldDecls[fieldName].GetSourceLocation()
                                         .CreateRemarkDiagnosticsNode("previous declaration: ")
-                                    })));
+                                })));
                     continue;
                 }


Add table storage test to verify Async and Top work together

--- src/Hyde.IntegrationTest/TableStorageProviderTest.cs
+++ src/Hyde.IntegrationTest/TableStorageProviderTest.cs
@@ -1736,7 +1736,7 @@

       [TestMethod]
       [TestCategory( "Integration" )]
-      public void GetCollection_ManyItemsInStore_TakeMethodReturnsProperAmount()
+      public void GetCollection_ManyItemsInStore_TopMethodReturnsProperAmount()
       {
          _tableStorageProvider.Add( _tableName, new TypeWithStringProperty
          {
@@ -1754,6 +1754,29 @@

          var result = _tableStorageProvider.GetCollection<TypeWithStringProperty>( _tableName, _partitionKey ).Top( 2 );
          Assert.AreEqual( 2, result.Count() );
+      }
+
+      [TestMethod]
+      [TestCategory( "Integration" )]
+      public void CreateQueryWithTopAsync_ManyItemsInStore_TopMethodReturnsProperAmount()
+      {
+         _tableStorageProvider.Add( _tableName, new TypeWithStringProperty
+         {
+            FirstType = "a"
+         }, _partitionKey, "a" );
+         _tableStorageProvider.Add( _tableName, new TypeWithStringProperty
+         {
+            FirstType = "b"
+         }, _partitionKey, "b" );
+         _tableStorageProvider.Add( _tableName, new TypeWithStringProperty
+         {
+            FirstType = "c"
+         }, _partitionKey, "c" );
+         _tableStorageProvider.Save();
+
+         var result = _tableStorageProvider.CreateQuery<TypeWithStringProperty>( _tableName ).PartitionKeyEquals( _partitionKey ).Top( 2 ).Async().Result;
+         Assert.AreEqual( 2, result.Count() );
+         Assert.AreEqual( "a", result.First().FirstType );
       }

       [TestMethod]


Fixed property names for UpsertExternalAsync so that they accurately reflect their role

--- src/ForceToolkitForNET/ForceClient.cs
+++ src/ForceToolkitForNET/ForceClient.cs
@@ -86,16 +86,16 @@
             return response;
         }

-        public async Task<bool> UpsertExternalAsync(string objectName, string externalId, string recordId, object record)
+        public async Task<bool> UpsertExternalAsync(string objectName, string externalFieldName, string externalId, object record)
         {
             if (string.IsNullOrEmpty(objectName)) throw new ArgumentNullException("objectName");
+            if (string.IsNullOrEmpty(externalFieldName)) throw new ArgumentNullException("externalFieldName");
             if (string.IsNullOrEmpty(externalId)) throw new ArgumentNullException("externalId");
-            if (string.IsNullOrEmpty(recordId)) throw new ArgumentNullException("recordId");
             if (record == null) throw new ArgumentNullException("record");

             //TODO: implement try/catch and throw auth exception if appropriate

-            var response = await _serviceHttpClient.HttpPatchAsync(record, string.Format("sobjects/{0}/{1}/{2}", objectName, externalId, recordId));
+            var response = await _serviceHttpClient.HttpPatchAsync(record, string.Format("sobjects/{0}/{1}/{2}", objectName, externalFieldName, externalId));
             return response;
         }


android log receiver

android log receiver

--- src/LogMagic.Android/Receivers/AndroidLogReceiver.cs
+++ src/LogMagic.Android/Receivers/AndroidLogReceiver.cs
@@ -1,42 +1,52 @@
 using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-
-using Android.App;
-using Android.Content;
-using Android.OS;
-using Android.Runtime;
-using Android.Views;
-using Android.Widget;
+using System.Threading;
+using Android.Util;

 namespace LogMagic.Receivers
 {
-   /// <summary>
-   /// Uses standard Android logging
-   /// </summary>
-   public class AndroidLogReceiver : ILogReceiver
+   class AndroidLogReceiver : ILogReceiver
    {
+      private readonly string _appName;
+
       /// <summary>
-      /// Create receiver with default formatter
+      /// Create a new instance of log receiver
       /// </summary>
-      public AndroidLogReceiver()
+      /// <param name="appName">Application name used as TAG in android logging. It's recommened to use app name so you can apply log
+      /// filtering based on it, instad of class name as Android is not that clever.</param>
+      public AndroidLogReceiver(string appName)
       {
-
+         if(appName == null) throw new ArgumentNullException(nameof(appName));
+         _appName = appName;
       }

-      /// <summary>
-      /// Sends chunk to the default Android logger
-      /// </summary>
-      /// <param name="chunk"></param>
       public void Send(LogChunk chunk)
       {
+         //this is the correct way to get current thread ID in Android
+         int androidThreadId = Thread.CurrentThread.ManagedThreadId;

+         string message = $"{androidThreadId}|{chunk.SourceName}|{chunk.Message}";
+         if(chunk.Error != null) message += $":{chunk.Error}";
+
+         Log.WriteLine(ToLogPriority(chunk.Severity), _appName, message);
       }

-      /// <summary>
-      /// Nothing to dispose
-      /// </summary>
+      private static LogPriority ToLogPriority(LogSeverity severity)
+      {
+         switch(severity)
+         {
+            case LogSeverity.Debug:
+               return LogPriority.Debug;
+            case LogSeverity.Error:
+               return LogPriority.Error;
+            case LogSeverity.Info:
+               return LogPriority.Error;
+            case LogSeverity.Warning:
+               return LogPriority.Warn;
+            default:
+               return LogPriority.Verbose;
+         }
+      }
+
       public void Dispose()
       {
       }


tests

tests

--- src/Maestro.Tests/ChildContainer_resolution_tests.cs
+++ src/Maestro.Tests/ChildContainer_resolution_tests.cs
@@ -36,4 +36,51 @@
 			childContainer.GetAll<object>().ShouldBe(new[] { "default child", "child", "parent" });
 		}
 	}
+
+	public class get_fallback_strategy_tests
+	{
+		[Fact]
+		public void should_fallback_to_default_instance_if_named_instance_is_missing()
+		{
+			var container = new Container(x =>
+			{
+				x.For<object>().Use("success");
+			});
+
+			container.Get<object>("test").ShouldBe("success");
+		}
+
+		[Fact(Skip = "feature missing")]
+		public void should_fallback_to_type_provider() { }
+
+		[Fact]
+		public void should_fallback_to_instantiating_concrete_closed_classes()
+		{
+			new Container().Get<Foo<string>>().ShouldNotBeNull();
+		}
+
+		[Fact]
+		public void should_prioritize_fallback_options()
+		{
+			var parentContainer = new Container();
+			var childContainer = parentContainer.GetChildContainer();
+
+			childContainer.Get<Foo<string>>("test").ShouldNotBeNull();
+
+			// parent type provider
+
+			// child type provider
+
+			parentContainer.Configure(x => x.For<Foo<string>>().Use<Foo<string>>().SetProperty(y => y.Value, "parent"));
+			childContainer.Get<Foo<string>>("test").Value.ShouldBe("parent");
+
+			childContainer.Configure(x => x.For<Foo<string>>().Use<Foo<string>>().SetProperty(y => y.Value, "child"));
+			childContainer.Get<Foo<string>>("test").Value.ShouldBe("child");
+		}
+
+		class Foo<T>
+		{
+			public T Value { get; set; }
+		}
+	}
 }


Remove some trailing whitespace

Remove some trailing whitespace

--- src/Summa/Summa.Gui/WebKitView.cs
+++ src/Summa/Summa.Gui/WebKitView.cs
@@ -39,7 +39,7 @@
         public class WebKitView : WebKit.WebView {
             public WebKitView() {NavigationRequested += new NavigationRequestedHandler (OnLinkClicked);

-                string starting_content = "Welcome to Summa, a GNOME feed reader.

This is a preview release, not intended to be used by anyone. Exercise caution.";
+                string starting_content = "Welcome to Summa, a GNOME feed reader.

This is a preview release, not intended to be used by anyone. Exercise caution.";
                 Render(starting_content);

                 ZoomTo(Summa.Core.Config.DefaultZoomLevel);


unittest

unittest

--- src/MagicOnion.Client.Unity/Assets/Scripts/Loader.cs
+++ src/MagicOnion.Client.Unity/Assets/Scripts/Loader.cs
@@ -9,6 +9,8 @@
 using System.Text;
 using Grpc.Core;
 using MagicOnion.Client;
+using MagicOnion.Resolvers;
+using MessagePack.Resolvers;

 namespace MagicOnion.Tests
 {
@@ -18,9 +20,13 @@
         public static void Register()
         {
             // Register First
-            //ZeroFormatterInitializer.Register();
             MagicOnionInitializer.Register();
-            //ZeroFormatter.Formatters.Formatter.RegisterArray<DefaultResolver, MyEnum>();
+
+            MessagePack.Resolvers.CompositeResolver.RegisterAndSetAsDefault(
+                MagicOnionResolver.Instance,
+                BuiltinResolver.Instance,
+                // Note:needs MessagePack generated resolver
+                StandardResolver.Instance);

             // Button ON
             RuntimeUnitTestToolkit.UnitTest.AddCustomAction("Use Local", () =>
@@ -29,7 +35,7 @@
             });
             RuntimeUnitTestToolkit.UnitTest.AddCustomAction("Use Remote", () =>
             {
-                UnitTestClient.endPoint = "104.199.192.165";
+                UnitTestClient.endPoint = "104.199.192.165"; // where is?
             });

 #if UNITY_EDITOR_WIN


Soptimize

Soptimize

--- src/Foundation/NSMutableDictionary.cs
+++ src/Foundation/NSMutableDictionary.cs
@@ -232,7 +232,15 @@
 				return ObjectForKey (key);
 			}
 			set {
-				SetObject (value, key);
+				if (key == null)
+					throw new ArgumentNullException ("key");
+				if (value == null)
+					throw new ArgumentNullException ("value");
+				if (IsDirectBinding) {
+					MonoMac.ObjCRuntime.Messaging.void_objc_msgSend_IntPtr_IntPtr (this.Handle, selSetObjectForKey, value.Handle, key.Handle);
+				} else {
+					MonoMac.ObjCRuntime.Messaging.void_objc_msgSendSuper_IntPtr_IntPtr (this.SuperHandle, selSetObjectForKey, value.Handle, key.Handle);
+				}
 			}
 		}


add await for InsertAsync

add await for InsertAsync

--- src/MicroOrm.Dapper.Repositories/DapperRepository.cs
+++ src/MicroOrm.Dapper.Repositories/DapperRepository.cs
@@ -845,7 +845,7 @@
             }
             else
             {
-                added = Connection.Execute(queryResult.GetSql(), instance, transaction) > 0;
+                added = await Connection.ExecuteAsync(queryResult.GetSql(), instance, transaction) > 0;
             }

             return added;


Fix typo - Move anchor to beginning of regex. (#1835)

--- src/Microsoft.DotNet.Build.Tasks.Feed/BlobUrlInfo.cs
+++ src/Microsoft.DotNet.Build.Tasks.Feed/BlobUrlInfo.cs
@@ -15,7 +15,7 @@
     public class BlobUrlInfo
     {
         private const string AccountNameAndEndpointRegex = @"^(?<accountname>[a-z0-9]+)\.(?<endpoint>.+?)";
-        private const string ContainerAndBlobRegex = @"/^(?<containername>[^\/]+)/(?<blobpath>.*)";
+        private const string ContainerAndBlobRegex = @"^/(?<containername>[^\/]+)/(?<blobpath>.*)";

         public string AccountName { get; set; }


NH3795/Fixture.cs: Minor indentation and warning fixes.

--- src/NHibernate.Test/NHSpecificTest/NH3795/Fixture.cs
+++ src/NHibernate.Test/NHSpecificTest/NH3795/Fixture.cs
@@ -10,8 +10,8 @@
 	[TestFixture]
 	public class Fixture : TestCase
 	{
-		protected Child childAliasField = null;
-		protected A aAliasField = null;
+		protected Child ChildAliasField = null;
+		protected A AAliasField = null;

 		protected override IList Mappings
 		{
@@ -24,10 +24,11 @@
 			using (var s = sessions.OpenSession())
 			{
 				A rowalias = null;
-				s.QueryOver(() => aAliasField)
-					.SelectList(list => list
-						.Select(() => aAliasField.Id).WithAlias(() => rowalias.Id))
-					.List();
+				s.QueryOver(() => AAliasField)
+				 .SelectList(
+					 list => list
+						 .Select(() => AAliasField.Id).WithAlias(() => rowalias.Id))
+				 .List();
 			}
 		}

@@ -37,10 +38,11 @@
 			using (var s = sessions.OpenSession())
 			{
 				B rowalias = null;
-				s.QueryOver(() => aAliasField)
-					.SelectList(list => list
-						.Select(() => ((B)aAliasField).Count).WithAlias(() => rowalias.Count))
-					.List();
+				s.QueryOver(() => AAliasField)
+				 .SelectList(
+					 list => list
+						 .Select(() => ((B) AAliasField).Count).WithAlias(() => rowalias.Count))
+				 .List();
 			}
 		}

@@ -51,10 +53,11 @@
 			{
 				Child rowalias = null;
 				s.QueryOver<Parent>()
-					.JoinAlias(p => p.Child, () => childAliasField)
-					.SelectList(list => list
-						.Select(() => childAliasField.Id).WithAlias(() => rowalias.Id))
-					.List();
+				 .JoinAlias(p => p.Child, () => ChildAliasField)
+				 .SelectList(
+					 list => list
+						 .Select(() => ChildAliasField.Id).WithAlias(() => rowalias.Id))
+				 .List();
 			}
 		}

@@ -65,40 +68,42 @@
 			{
 				Child rowalias = null;
 				s.QueryOver<Parent>()
-					.JoinQueryOver(p => p.Child, () => childAliasField)
-					.SelectList(list => list
-						.Select(() => childAliasField.Id).WithAlias(() => rowalias.Id))
-				.List();
+				 .JoinQueryOver(p => p.Child, () => ChildAliasField)
+				 .SelectList(
+					 list => list
+						 .Select(() => ChildAliasField.Id).WithAlias(() => rowalias.Id))
+				 .List();
 			}
 		}

 		[Test]
 		public void TestAliasInQueryOver()
 		{
-			Child childAlias = null;
 			A aAlias = null;
 			using (var s = sessions.OpenSession())
 			{
 				A rowalias = null;
 				s.QueryOver(() => aAlias)
-					.SelectList(list => list
-						.Select(() => aAlias.Id).WithAlias(() => rowalias.Id))
-					.List();
+				 .SelectList(
+					 list => list
+						 .Select(() => aAlias.Id)
+						 .WithAlias(() => rowalias.Id))
+				 .List();
 			}
 		}

 		[Test]
 		public void TestAliasInQueryOverWithConversion()
 		{
-			Child childAlias = null;
 			A aAlias = null;
 			using (var s = sessions.OpenSession())
 			{
 				B rowalias = null;
 				s.QueryOver(() => aAlias)
-					.SelectList(list => list
-						.Select(() => ((B) aAlias).Count).WithAlias(() => rowalias.Count))
-					.List();
+				 .SelectList(
+					 list => list.Select(() => ((B) aAlias).Count)
+								 .WithAlias(() => rowalias.Count))
+				 .List();
 			}
 		}

@@ -106,15 +111,16 @@
 		public void TestAliasInJoinAlias()
 		{
 			Child childAlias = null;
-			A aAlias = null;
+
 			using (var s = sessions.OpenSession())
 			{
 				Child rowalias = null;
 				s.QueryOver<Parent>()
-					.JoinAlias(p => p.Child, () => childAlias)
-					.SelectList(list => list
-						.Select(() => childAlias.Id).WithAlias(() => rowalias.Id))
-					.List();
+				 .JoinAlias(p => p.Child, () => childAlias)
+				 .SelectList(
+					 list => list.Select(() => childAlias.Id)
+								 .WithAlias(() => rowalias.Id))
+				 .List();
 			}
 		}

@@ -122,15 +128,16 @@
 		public void TestAliasInJoinQueryOver()
 		{
 			Child childAlias = null;
-			A aAlias = null;
+
 			using (var s = sessions.OpenSession())
 			{
 				Child rowalias = null;
 				s.QueryOver<Parent>()
-					.JoinQueryOver(p => p.Child, () => childAlias)
-					.SelectList(list => list
-						.Select(() => childAlias.Id).WithAlias(() => rowalias.Id))
-					.List();
+				 .JoinQueryOver(p => p.Child, () => childAlias)
+				 .SelectList(
+					 list => list.Select(() => childAlias.Id)
+								 .WithAlias(() => rowalias.Id))
+				 .List();
 			}
 		}
 	}


Added MonoDevelop.NUnit to the list of ignored assemblies

--- src/Nancy/Bootstrapper/NancyInternalConfiguration.cs
+++ src/Nancy/Bootstrapper/NancyInternalConfiguration.cs
@@ -42,7 +42,8 @@
                 asm => asm.FullName.StartsWith("IronPython", StringComparison.InvariantCulture),
                 asm => asm.FullName.StartsWith("IronRuby", StringComparison.InvariantCulture),
                 asm => asm.FullName.StartsWith("xunit", StringComparison.InvariantCulture),
-                asm => asm.FullName.StartsWith("Nancy.Testing", StringComparison.InvariantCulture)
+                asm => asm.FullName.StartsWith("Nancy.Testing", StringComparison.InvariantCulture),
+				asm => asm.FullName.StartsWith("MonoDevelop.NUnit", StringComparison.InvariantCulture),
             };

         /// <summary>
@@ -276,4 +277,4 @@
             return this;
         }
     }
-}+}


add save presentation as PNG option

add save presentation as PNG option

--- src/OfficeScript/OfficeScript/Report/Presentation.cs
+++ src/OfficeScript/OfficeScript/Report/Presentation.cs
@@ -266,6 +266,9 @@
                     break;
                 case "ppt":
                     pptFileType = PowerPoint.Enums.PpSaveAsFileType.ppSaveAsPresentation;
+                    break;
+                case "png":
+                    pptFileType = PowerPoint.Enums.PpSaveAsFileType.ppSaveAsPNG;
                     break;
                 default:
                     pptFileType = PowerPoint.Enums.PpSaveAsFileType.ppSaveAsOpenXMLPresentation;


Hid job reference from master layout

Hid job reference from master layout

--- src/Galaxy/WebEnd/Views/Master.cshtml
+++ src/Galaxy/WebEnd/Views/Master.cshtml
@@ -51,7 +51,7 @@

Dashboard

Feeds

Deployments

-
Jobs

+          @*
Jobs
*@

Options


added slideHeight and slideWidth

added slideHeight and slideWidth

--- src/OfficeScript/OfficeScript/Report/Presentation.cs
+++ src/OfficeScript/OfficeScript/Report/Presentation.cs
@@ -377,6 +377,24 @@
                 return this.presentation.FullName;
             }
         }
+
+        public float SlideHeight
+        {
+            get
+            {
+                return this.presentation.PageSetup.SlideHeight;
+            }
+
+        }
+
+        public float SlideWidth
+        {
+            get
+            {
+                return this.presentation.PageSetup.SlideWidth;
+            }
+
+        }
         #endregion
     }
 }


Fixing ResetPasswordSettings deployment step (#10920)

--- src/OrchardCore.Modules/OrchardCore.Users/Startup.cs
+++ src/OrchardCore.Modules/OrchardCore.Users/Startup.cs
@@ -455,7 +455,7 @@
     {
         public override void ConfigureServices(IServiceCollection services)
         {
-            services.AddSiteSettingsPropertyDeploymentStep<ResetPasswordDeploymentStartup, ResetPasswordDeploymentStartup>(S => S["Reset Password settings"], S => S["Exports the Reset Password settings."]);
+            services.AddSiteSettingsPropertyDeploymentStep<ResetPasswordSettings, ResetPasswordDeploymentStartup>(S => S["Reset Password settings"], S => S["Exports the Reset Password settings."]);
         }
     }