Updated FacetDataCache.cs to 4.0.2 compatibility.

--- src/BoboBrowse.Net/BoboBrowse.Net/Facets/Data/FacetDataCache.cs
+++ src/BoboBrowse.Net/BoboBrowse.Net/Facets/Data/FacetDataCache.cs
@@ -17,14 +17,15 @@
 //* See the License for the specific language governing permissions and
 //* limitations under the License.

-// Version compatibility level: 3.2.0
+// Version compatibility level: 4.0.2
 namespace BoboBrowse.Net.Facets.Data
 {
     using BoboBrowse.Net.Sort;
+    using BoboBrowse.Net.Support;
     using BoboBrowse.Net.Util;
-    using Common.Logging;
     using Lucene.Net.Index;
     using Lucene.Net.Search;
+    using Lucene.Net.Util;
     using System;
     using System.Collections.Generic;
     using System.Linq;
@@ -32,8 +33,6 @@
     [Serializable]
     public class FacetDataCache
     {
-        private static ILog logger = LogManager.GetLogger(typeof(FacetDataCache));
-
         //private readonly static long serialVersionUID = 1L; // NOT USED

         protected BigSegmentedArray orderArray;
@@ -114,58 +113,46 @@
                 return new BigIntArray(maxDoc);
         }

-        protected int GetDictValueCount(IndexReader reader, string field)
+        protected int GetDictValueCount(AtomicReader reader, string field)
         {
             int ret = 0;
-            using (TermEnum termEnum = reader.Terms(new Term(field, "")))
-            {
-                do
-                {
-                    Term term = termEnum.Term;
-                    if (term == null || string.CompareOrdinal(term.Field, field) != 0)
-                        break;
-                    ret++;
-                } while (termEnum.Next());
+            Terms terms = reader.Terms(field);
+            if (terms == null)
+            {
+                return ret;
+            }
+            return (int)terms.Size();
+        }
+
+        protected int GetNegativeValueCount(AtomicReader reader, string field)
+        {
+            int ret = 0;
+            Terms terms = reader.Terms(field);
+            if (terms == null)
+            {
+                return ret;
+            }
+            TermsEnum termsEnum = terms.Iterator(null);
+            BytesRef text;
+            while ((text = termsEnum.Next()) != null)
+            {
+                if (!text.Utf8ToString().StartsWith("-"))
+                {
+                    break;
+                }
+                ret++;
             }
             return ret;
         }

-        protected int GetNegativeValueCount(IndexReader reader, string field)
-        {
-            int ret = 0;
-            using (TermEnum termEnum = reader.Terms(new Term(field, "")))
-            {
-                do
-                {
-                    Term term = termEnum.Term;
-                    if (term == null || string.CompareOrdinal(term.Field, field) != 0)
-                        break;
-                    if (!term.Text.StartsWith("-"))
-                    {
-                        break;
-                    }
-                    ret++;
-                } while (termEnum.Next());
-            }
-            return ret;
-        }
-
-        public virtual void Load(string fieldName, IndexReader reader, TermListFactory listFactory)
+        public virtual void Load(string fieldName, AtomicReader reader, TermListFactory listFactory)
         {
             string field = string.Intern(fieldName);
             int maxDoc = reader.MaxDoc;

-            BigSegmentedArray order = this.orderArray;
-            if (order == null) // we want to reuse the memory
-            {
-                int dictValueCount = GetDictValueCount(reader, fieldName);
-                order = NewInstance(dictValueCount, maxDoc);
-            }
-            else
-            {
-                order.EnsureCapacity(maxDoc); // no need to fill to 0, we are reseting the
-                                              // data anyway
-            }
+            int dictValueCount = GetDictValueCount(reader, fieldName);
+            BigSegmentedArray order = NewInstance(dictValueCount, maxDoc);
+
             this.orderArray = order;

             List<int> minIDList = new List<int>();
@@ -176,68 +163,57 @@
             ITermValueList list = listFactory == null ? (ITermValueList)new TermStringList() : listFactory.CreateTermList();
             int negativeValueCount = GetNegativeValueCount(reader, field);

-            TermDocs termDocs = reader.TermDocs();
-            TermEnum termEnum = reader.Terms(new Term(field, ""));
-            int t = 0; // current term number
+            int t = 1; // valid term id starts from 1

             list.Add(null);
             minIDList.Add(-1);
             maxIDList.Add(-1);
             freqList.Add(0);
             int totalFreq = 0;
-            //int df = 0;
-            t++;
-            try
-            {
-                do
-                {
-                    Term term = termEnum.Term;
-                    if (term == null || string.CompareOrdinal(term.Field, field) != 0)
-                        break;
-
-                    // store term text
-                    // we expect that there is at most one term per document
-
-                    // Alexey: well, we could get now more than one term per document. Effectively, we could build facet against tokenized field
-                    //if (t >= length)
-                    //{
-                    //    throw new RuntimeException("there are more terms than " + "documents in field \"" + field
-                    //        + "\", but it's impossible to sort on " + "tokenized fields");
-                    //}
-                    list.Add(term.Text);
-                    termDocs.Seek(termEnum);
-                    // freqList.add(termEnum.docFreq()); // doesn't take into account deldocs
-                    int minID = -1;
-                    int maxID = -1;
-                    int df = 0;
-                    int valId = (t - 1 < negativeValueCount) ? (negativeValueCount - t + 1) : t;
-                    if (termDocs.Next())
-                    {
-                        df++;
-                        int docid = termDocs.Doc;
-                        order.Add(docid, valId);
-                        minID = docid;
-                        while (termDocs.Next())
-                        {
-                            df++;
-                            docid = termDocs.Doc;
-                            order.Add(docid, valId);
-                        }
-                        maxID = docid;
-                    }
-                    freqList.Add(df);
-                    totalFreq += df;
-                    minIDList.Add(minID);
-                    maxIDList.Add(maxID);
-
-                    t++;
-                } while (termEnum.Next());
-            }
-            finally
-            {
-                termDocs.Dispose();
-                termEnum.Dispose();
-            }
+            Terms terms = reader.Terms(field);
+            if (terms != null)
+            {
+                TermsEnum termsEnum = terms.Iterator(null);
+                  BytesRef text;
+                  while ((text = termsEnum.Next()) != null)
+                  {
+                      // store term text
+                      // we expect that there is at most one term per document
+                      if (t >= length) throw new RuntimeException("there are more terms than "
+                        + "documents in field \"" + field + "\", but it's impossible to sort on "
+                        + "tokenized fields");
+                      string strText = text.Utf8ToString();
+                      list.Add(strText);
+                      Term term = new Term(field, strText);
+                      DocsEnum docsEnum = reader.TermDocsEnum(term);
+                      // freqList.add(termEnum.docFreq()); // doesn't take into account
+                      // deldocs
+                      int minID = -1;
+                      int maxID = -1;
+                      int docID = -1;
+                      int df = 0;
+                      int valId = (t - 1 < negativeValueCount) ? (negativeValueCount - t + 1) : t;
+                      while ((docID = docsEnum.NextDoc()) != DocsEnum.NO_MORE_DOCS)
+                      {
+                          df++;
+                          order.Add(docID, valId);
+                          minID = docID;
+                          while (docsEnum.NextDoc() != DocsEnum.NO_MORE_DOCS)
+                          {
+                              docID = docsEnum.DocID();
+                              df++;
+                              order.Add(docID, valId);
+                          }
+                          maxID = docID;
+                      }
+                      freqList.Add(df);
+                      totalFreq += df;
+                      minIDList.Add(minID);
+                      maxIDList.Add(maxID);
+                      t++;
+                  }
+            }
+
             list.Seal();
             this.valArray = list;
             this.freqs = freqList.ToArray();
@@ -245,25 +221,22 @@
             this.maxIDs = maxIDList.ToArray();

             int doc = 0;
-            while (doc <= maxDoc && order.Get(doc) != 0)
+            while (doc < maxDoc && order.Get(doc) != 0)
             {
                 ++doc;
             }
-            if (doc <= maxDoc)
+            if (doc < maxDoc)
             {
                 this.minIDs[0] = doc;
                 // Try to get the max
-                doc = maxDoc;
-                while (doc > 0 && order.Get(doc) != 0)
+                doc = maxDoc - 1;
+                while (doc >= 0 && order.Get(doc) != 0)
                 {
                     --doc;
                 }
-                if (doc > 0)
-                {
-                    this.maxIDs[0] = doc;
-                }
-            }
-            this.freqs[0] = maxDoc + 1 - totalFreq;
+                this.maxIDs[0] = doc;
+            }
+            this.freqs[0] = reader.NumDocs - totalFreq;
         }

         private static int[] ConvertString(FacetDataCache dataCache, string[] vals)
@@ -320,17 +293,17 @@

     public class FacetDocComparatorSource : DocComparatorSource
     {
-        private IFacetHandler _facetHandler;
+        private readonly IFacetHandler _facetHandler;

         public FacetDocComparatorSource(IFacetHandler facetHandler)
         {
             _facetHandler = facetHandler;
         }

-        public override DocComparator GetComparator(IndexReader reader, int docbase)
-        {
-            if (!(reader.GetType().Equals(typeof(BoboSegmentReader))))
-                throw new ArgumentException("reader not instance of BoboIndexReader");
+        public override DocComparator GetComparator(AtomicReader reader, int docbase)
+        {
+            if (!(reader is BoboSegmentReader))
+                throw new ArgumentException("reader not instance of BoboSegmentReader");
             BoboSegmentReader boboReader = (BoboSegmentReader)reader;
             FacetDataCache dataCache = _facetHandler.GetFacetData<FacetDataCache>(boboReader);
             BigSegmentedArray orderArray = dataCache.OrderArray;


memoize TypeSystemServices.Find(Implicit|Explicit)ConversionOperator

--- src/Boo.Lang.Compiler/TypeSystem/Services/TypeSystemServices.cs
+++ src/Boo.Lang.Compiler/TypeSystem/Services/TypeSystemServices.cs
@@ -123,6 +123,8 @@
 		protected Set<string> _literalPrimitives = new Set<string>();
 		protected Hashtable _primitives = new Hashtable();
 		private DowncastPermissions _downcastPermissions;
+		private MemoizedFunction<IType, IType, IMethod> _findImplicitConversionOperator;
+		private MemoizedFunction<IType, IType, IMethod> _findExplicitConversionOperator;

 		public TypeSystemServices() : this(new CompilerContext())
 		{
@@ -134,6 +136,13 @@

 			_context = context;
 			_anonymousCallablesManager = new AnonymousCallablesManager(this);
+
+			_findImplicitConversionOperator =
+				new MemoizedFunction<IType, IType, IMethod>((fromType, toType) => FindConversionOperator("op_Implicit", fromType, toType));
+			_findExplicitConversionOperator =
+				new MemoizedFunction<IType, IType, IMethod>((fromType, toType) => FindConversionOperator("op_Explicit", fromType, toType));
+
+			context.Provide<CurrentScope>().Changed += (sender, args) => ClearScopeDependentMemoizedFunctions();

 			DuckType = Map(typeof(Builtins.duck));
 			IQuackFuType = Map(typeof(IQuackFu));
@@ -188,6 +197,12 @@
 			PrepareBuiltinFunctions();
 		}

+		private void ClearScopeDependentMemoizedFunctions()
+		{
+			_findImplicitConversionOperator.Clear();
+			_findExplicitConversionOperator.Clear();
+		}
+
 		public CompilerContext Context
 		{
 			get { return _context; }
@@ -636,15 +651,15 @@

 		public IMethod FindExplicitConversionOperator(IType fromType, IType toType)
 		{
-			return FindConversionOperator("op_Explicit", fromType, toType);
+			return _findExplicitConversionOperator.Invoke(fromType, toType);
 		}

 		public IMethod FindImplicitConversionOperator(IType fromType, IType toType)
 		{
-			return FindConversionOperator("op_Implicit", fromType, toType);
-		}
-
-		public IMethod FindConversionOperator(string name, IType fromType, IType toType)
+			return _findImplicitConversionOperator.Invoke(fromType, toType);
+		}
+
+		private IMethod FindConversionOperator(string name, IType fromType, IType toType)
 		{
 			while (fromType != ObjectType)
 			{


use refs in TextKeyedCache

use refs in TextKeyedCache

--- src/Compilers/Core/Portable/InternalUtilities/TextKeyedCache.cs
+++ src/Compilers/Core/Portable/InternalUtilities/TextKeyedCache.cs
@@ -15,26 +15,6 @@
 {
     internal class TextKeyedCache<T> where T : class
     {
-        // entry in the local cache
-        private struct LocalEntry
-        {
-            // full text of the item
-            public string Text;
-
-            // hash code of the entry
-            public int HashCode;
-
-            // item
-            public T Item;
-        }
-
-        // entry in the shared cache
-        private struct SharedEntry
-        {
-            public int HashCode;
-            public SharedEntryValue Entry;
-        }
-
         // immutable tuple - text and corresponding item
         // reference type because we want atomic assignments
         private class SharedEntryValue
@@ -71,17 +51,17 @@
         // local cache
         // simple fast and not threadsafe cache
         // with limited size and "last add wins" expiration policy
-        private readonly LocalEntry[] _localTable = new LocalEntry[LocalSize];
+        private readonly (string Text, int HashCode, T Item)[] _localTable = new(string Text, int HashCode, T Item)[LocalSize];

         // shared threadsafe cache
         // slightly slower than local cache
         // we read this cache when having a miss in local cache
         // writes to local cache will update shared cache as well.
-        private static readonly SharedEntry[] s_sharedTable = new SharedEntry[SharedSize];
+        private static readonly (int HashCode, SharedEntryValue Entry)[] s_sharedTable = new(int HashCode, SharedEntryValue Entry)[SharedSize];

         // store a reference to shared cache locally
         // accessing a static field of a generic type could be nontrivial
-        private readonly SharedEntry[] _sharedTableInst = s_sharedTable;
+        private readonly (int HashCode, SharedEntryValue Entry)[] _sharedTableInst = s_sharedTable;

         private readonly StringTable _strings;

@@ -131,31 +111,27 @@

         internal T FindItem(char[] chars, int start, int len, int hashCode)
         {
-            // capture array to avoid extra range checks
-            var arr = _localTable;
-            var idx = LocalIdxFromHash(hashCode);
-
-            var text = arr[idx].Text;
-
-            if (text != null && arr[idx].HashCode == hashCode)
+            // get direct element reference to avoid extra range checks
+            ref var localSlot = ref _localTable[LocalIdxFromHash(hashCode)];
+
+            var text = localSlot.Text;
+
+            if (text != null && localSlot.HashCode == hashCode)
             {
                 if (StringTable.TextEquals(text, chars, start, len))
                 {
-                    return arr[idx].Item;
+                    return localSlot.Item;
                 }
             }

             SharedEntryValue e = FindSharedEntry(chars, start, len, hashCode);
             if (e != null)
             {
-                // PERF: the following code does element-wise assignment of a struct
-                //       because current JIT produces better code compared to
-                //       arr[idx] = new LocalEntry(...)
-                arr[idx].HashCode = hashCode;
-                arr[idx].Text = e.Text;
+                localSlot.HashCode = hashCode;
+                localSlot.Text = e.Text;

                 var tk = e.Item;
-                arr[idx].Item = tk;
+                localSlot.Item = tk;

                 return tk;
             }
@@ -169,12 +145,13 @@
             int idx = SharedIdxFromHash(hashCode);

             SharedEntryValue e = null;
+            int hash;
+
             // we use quadratic probing here
             // bucket positions are (n^2 + n)/2 relative to the masked hashcode
             for (int i = 1; i < SharedBucketSize + 1; i++)
             {
-                e = arr[idx].Entry;
-                int hash = arr[idx].HashCode;
+                (hash, e) = arr[idx];

                 if (e != null)
                 {
@@ -207,11 +184,10 @@
             AddSharedEntry(hashCode, e);

             // add to the local table too
-            var arr = _localTable;
-            var idx = LocalIdxFromHash(hashCode);
-            arr[idx].HashCode = hashCode;
-            arr[idx].Text = text;
-            arr[idx].Item = item;
+            ref var localSlot = ref _localTable[LocalIdxFromHash(hashCode)];
+            localSlot.HashCode = hashCode;
+            localSlot.Text = text;
+            localSlot.Item = item;
         }

         private void AddSharedEntry(int hashCode, SharedEntryValue e)


Catching FaceApiExceptions and logging in identification training function.

--- src/EmoApi/AzureFunctions/IdentificationTrainingFunction/run.cs
+++ src/EmoApi/AzureFunctions/IdentificationTrainingFunction/run.cs
@@ -23,38 +23,49 @@
             var faceApiKey = Environment.GetEnvironmentVariable("faceApiKey", EnvironmentVariableTarget.Process);
             var faceServiceClient = new FaceServiceClient(faceApiKey);

-            // Detect face, or return
-            var detectedFaces = await faceServiceClient.DetectAsync(imageUri);
-            if (detectedFaces.Length == 0)
-            {
-                log.Warning("No face detected...");
-                return;
-            }
-
-            // Prepare person group
-            await faceServiceClient.CreatePersonGroupIfNotExising(PersonGroupId, "NovanetNDC2017");
-            await faceServiceClient.WaitForPersonGroupStatusNotRunning(PersonGroupId, log);
-
-            // Add user as new person to group, or return existing
-            var user = await GetUserFromBlobName(name);
-            var personId = await faceServiceClient.CreateUserAsPersonIfNotExising(PersonGroupId, user);
-
-            // Add face to person
             try
             {
-                // Using imageUri as user data, so we can display images later if needed
-                await faceServiceClient.AddPersonFaceAsync(PersonGroupId, personId, imageUri, imageUri);
+                // Detect face, or return
+                var detectedFaces = await faceServiceClient.DetectAsync(imageUri);
+                if (detectedFaces.Length == 0)
+                {
+                    log.Warning("No face detected...");
+                    return;
+                }
+
+                // Prepare person group
+                await faceServiceClient.CreatePersonGroupIfNotExising(PersonGroupId, "NovanetNDC2017");
+                await faceServiceClient.WaitForPersonGroupStatusNotRunning(PersonGroupId, log);
+
+                // Add user as new person to group, or return existing
+                var user = await GetUserFromBlobName(name);
+                var personId = await faceServiceClient.CreateUserAsPersonIfNotExising(PersonGroupId, user);
+
+                // Add face to person
+                try
+                {
+                    // Using imageUri as user data, so we can display images later if needed
+                    await faceServiceClient.AddPersonFaceAsync(PersonGroupId, personId, imageUri, imageUri);
+                }
+                catch (FaceAPIException)
+                {
+                    // No face found, not a real person!
+                    log.Warning("No face found in image. WHYYYY! THAT WAS THE FIRST THING WE CHECKED!!! OMG.");
+                }
+
+                // Train the person group
+                await faceServiceClient.TrainPersonGroupAsync(PersonGroupId);
+                var trainingStatus = await faceServiceClient.GetPersonGroupTrainingStatusAsync(PersonGroupId);
+                log.Info($"Started training. Status: {trainingStatus.Status}");
             }
-            catch (FaceAPIException)
+            catch (FaceAPIException tooUglyException)
             {
-                // No face found, not a real person!
-                log.Warning("No face found in image. WHYYYY! THAT WAS THE FIRST THING WE CHECKED!!! OMG.");
+                log.Error($"Face API: {tooUglyException.ErrorMessage}");
+                if (tooUglyException.InnerException != null)
+                {
+                    log.Error($"Face API: {tooUglyException.InnerException.Message}");
+                }
             }
-
-            // Train the person group
-            await faceServiceClient.TrainPersonGroupAsync(PersonGroupId);
-            var trainingStatus = await faceServiceClient.GetPersonGroupTrainingStatusAsync(PersonGroupId);
-            log.Info($"Started training. Status: {trainingStatus.Status}");
         }

         private static async Task<User> GetUserFromBlobName(string name)


Fixed building

Fixed building

--- src/MonoDevelop.Dnx/MonoDevelop.Dnx/DnxMSBuildProjectHandler.cs
+++ src/MonoDevelop.Dnx/MonoDevelop.Dnx/DnxMSBuildProjectHandler.cs
@@ -92,7 +92,7 @@
 		void AddPropertyWithNotEmptyCondition (MSBuildPropertyGroup propertyGroup, string name, string unevaluatedValue)
 		{
 			string condition = String.Format("'$({0})' == ''", name);
-			propertyGroup.SetValue (name, unevaluatedValue, null, false, condition);
+			propertyGroup.SetValue (name, unevaluatedValue, condition: condition);
 		}

 		MSBuildProperty AddProperty (MSBuildPropertyGroup propertyGroup, string name, string unevaluatedValue)


Give error message when a regex filter is used with NUnit V2

--- src/NUnitEngine/Addins/nunit.v2.driver/NUnit2FrameworkDriver.cs
+++ src/NUnitEngine/Addins/nunit.v2.driver/NUnit2FrameworkDriver.cs
@@ -187,9 +187,13 @@
                     return new Core.Filters.NotFilter(FromXml(xmlNode.FirstChild));

                 case "test":
+                    if (xmlNode.Attributes["re"] != null)
+                        throw new NUnitEngineException("Filters with regular expressions are only supported when running NUnit 3 tests");
                     return new Core.Filters.SimpleNameFilter(xmlNode.InnerText);

                 case "cat":
+                    if (xmlNode.Attributes["re"] != null)
+                        throw new NUnitEngineException("Filters with regular expressions are only supported when running NUnit 3 tests");
                     var catFilter = new Core.Filters.CategoryFilter();
                     foreach (string cat in xmlNode.InnerText.Split(COMMA))
                         catFilter.AddCategory(cat);


Set instance name correctly for tests.

Set instance name correctly for tests.

--- src/QuartzNET-DynamoDB.Tests/Integration/DynamoClientFactory.cs
+++ src/QuartzNET-DynamoDB.Tests/Integration/DynamoClientFactory.cs
@@ -6,12 +6,11 @@
     public class DynamoClientFactory
     {
         private static JobStore _store;
-        private static string InstanceName;
+        private static string InstanceName = Guid.NewGuid().ToString();

         public static DynamoDB.JobStore CreateTestJobStore()
         {
             _store = new JobStore();
-            InstanceName = Guid.NewGuid().ToString();
             _store.InstanceName = InstanceName;

             return _store;


renamed internal classes fixed minor issue in LinqExpressionToQueryExpressionTranslator.VisitMethodCall method

--- src/Remote.Linq/System.Linq.Expressions/ExpressionTranslator.cs
+++ src/Remote.Linq/System.Linq.Expressions/ExpressionTranslator.cs
@@ -33,7 +33,7 @@
                 return _cache.Values.ToList();
             }
         }
-
+
         /// <summary>
         /// Translates a given lambda expression into a query expression
         /// </summary>
@@ -41,9 +41,9 @@
         /// <returns></returns>
         public static RLinq.LambdaExpression ToQueryExpression(this LambdaExpression expression)
         {
-            return new ExpressionToQueryExpressionTranslator().ToFilterExpression(expression);
-        }
-
+            return new LinqExpressionToQueryExpressionTranslator().ToFilterExpression(expression);
+        }
+
         /// <summary>
         /// Translates a given query expression into an expression
         /// </summary>
@@ -51,7 +51,7 @@
         /// <returns></returns>
         public static Expression ToLinqExpression(this RLinq.Expression expression)
         {
-            var exp = new FilterExpressionToExpressionTranslator(new ParameterCache()).ToExpression(expression);
+            var exp = new QueryExpressionToLinqExpressionTranslator(new ParameterCache()).ToExpression(expression);
             return exp;
         }

@@ -99,7 +99,7 @@
         {
             //var lambdaExpression = (LambdaExpression)expression.ToLinqExpression();
             var parameterCache = new ParameterCache();
-            var lambdaExpression = new FilterExpressionToExpressionTranslator(parameterCache).ToExpression(expression);
+            var lambdaExpression = new QueryExpressionToLinqExpressionTranslator(parameterCache).ToExpression(expression);
             return (LambdaExpression)lambdaExpression;
         }

@@ -120,7 +120,7 @@
             }
         }

-        private sealed class ExpressionToQueryExpressionTranslator : ExpressionVisitorBase
+        private sealed class LinqExpressionToQueryExpressionTranslator : ExpressionVisitorBase
         {
             public RLinq.LambdaExpression ToFilterExpression(LambdaExpression expression)
             {
@@ -320,7 +320,7 @@
                 var propertyInfo = (PropertyInfo)m.Member;
                 return new RLinq.PropertyAccessExpression(instance, propertyInfo).Wrap();
             }
-
+
             protected override Expression VisitMethodCall(MethodCallExpression m)
             {
                 // property selector
@@ -332,7 +332,8 @@
                     if (propertyInfo == null) throw new Exception(string.Format("'{0}' is not a valid or an ambiguous property of type {1}", (string)exp.Value, m.Object.Type.FullName));
                     return new RLinq.PropertyAccessExpression(instance, propertyInfo).Wrap();
                 }
-                else if (m.Object != null && m.Object.Type == typeof(string) && m.Arguments.Count == 1)
+
+                if (m.Object != null && m.Object.Type == typeof(string) && m.Arguments.Count == 1)
                 {
                     var obj = Visit(m.Object);
                     var p1 = obj.Unwrap();
@@ -350,7 +351,8 @@
                             return new RLinq.BinaryExpression(p1, p2, RLinq.BinaryOperator.EndsWith).Wrap();
                     }
                 }
-                else if (m.Method.Name == "Contains" && m.Object == null && m.Arguments.Count == 2 && m.Arguments[0].NodeType == ExpressionType.Constant && ((ConstantExpression)m.Arguments[0]).Value is System.Collections.IEnumerable)
+
+                if (m.Method.Name == "Contains" && m.Object == null && m.Arguments.Count == 2 && m.Arguments[0].NodeType == ExpressionType.Constant && ((ConstantExpression)m.Arguments[0]).Value is System.Collections.IEnumerable)
                 {
                     var collection = ((ConstantExpression)m.Arguments[0]).Value;
                     var collectionType = collection.GetType();
@@ -376,7 +378,7 @@

                     return new RLinq.BinaryExpression(a2, new RLinq.CollectionExpression(list, elementType), RLinq.BinaryOperator.In).Wrap();
                 }
-                else
+
                 {
                     var instance = m.Object == null ? null : Visit(m.Object).Unwrap();
                     var arguments =
@@ -386,7 +388,7 @@
                     return new RLinq.MethodCallExpression(instance, ((MethodCallExpression)m).Method, arguments).Wrap();
                 }

-                throw CreateNotSupportedException(m);
+                //throw CreateNotSupportedException(m);
             }

             protected override Expression VisitLambda(LambdaExpression lambda)
@@ -471,7 +473,7 @@
             }
         }

-        private sealed class FilterExpressionToExpressionTranslator
+        private sealed class QueryExpressionToLinqExpressionTranslator
         {
             private static readonly MethodInfo StringStartsWithMethodInfo = typeof(string).GetMethod("StartsWith", new[] { typeof(string) });
             private static readonly MethodInfo StringEndsWithMethodInfo = typeof(string).GetMethod("EndsWith", new[] { typeof(string) });
@@ -482,7 +484,7 @@

             private readonly ParameterCache _parameterCache;

-            public FilterExpressionToExpressionTranslator(ParameterCache parameterCache)
+            public QueryExpressionToLinqExpressionTranslator(ParameterCache parameterCache)
             {
                 _parameterCache = parameterCache;
             }
@@ -544,7 +546,7 @@
             private Expression Visit(RLinq.PropertyAccessExpression propertyAccessExpression)
             {
                 var exp = Visit(propertyAccessExpression.Instance);
-                return Expression.MakeMemberAccess(exp, propertyAccessExpression.PropertyInfo);
+                return Expression.MakeMemberAccess(exp, propertyAccessExpression.PropertyInfo);
             }

             private Expression Visit(RLinq.MethodCallExpression methodCallExpression)
@@ -576,11 +578,11 @@

                 if (collectionExpression.ElementType == typeof(object))
                 {
-                    return Expression.Constant(collection.ToList());
+                    return Expression.Constant(collection.ToArray());
                 }
                 else
                 {
-                    var objectCollectionExpression = Expression.Constant(collection);
+                    var objectCollectionExpression = Expression.Constant(collection.ToArray());
                     var typeConvertionMethodExpression = Expression.Call(null, EnumerableOfTypeMethodInfo.MakeGenericMethod(collectionExpression.ElementType), objectCollectionExpression);
                     var toListMethodExpression = Expression.Call(null, EnumerableToListMethodInfo.MakeGenericMethod(collectionExpression.ElementType), typeConvertionMethodExpression);
                     var obj = Expression.Lambda(toListMethodExpression).Compile().DynamicInvoke();
@@ -610,7 +612,7 @@
                         {
                             var typeConvertionMethod = Expression.Call(null, EnumerableOfTypeMethodInfo.MakeGenericMethod(p1.Type), p2);
                             var obj = Expression.Lambda(typeConvertionMethod).Compile().DynamicInvoke();
-                            var exp =  Expression.Constant(obj);
+                            var exp = Expression.Constant(obj);
                             return Expression.Call(null, EnumerableContainsMethodInfo.MakeGenericMethod(p1.Type), exp, p1);
                         }
                     default:


QY v4.2.4 1、修改JSSDKHelper.GetNoncestr()方法；2、优化TenPayLib.BuildRandomStr()方法

--- src/Senparc.Weixin.QY/Senparc.Weixin.QY/TenPayLib/TenPayUtil.cs
+++ src/Senparc.Weixin.QY/Senparc.Weixin.QY/TenPayLib/TenPayUtil.cs
@@ -10,11 +10,14 @@
     ޸ıʶSenparc - 20161014
     ޸޸TenPayUtil.BuildRandomStr()

+    ޸ıʶSenparc - 20161014
+    ޸޸TenPayUtil.BuildRandomStr()
+
 ----------------------------------------------------------------*/

 using System;
 using System.Text;
-using Senparc.Weixin.QY.Helpers;
+using Senparc.Weixin.Helpers;

 namespace Senparc.Weixin.QY.TenPayLib
 {
@@ -24,14 +27,15 @@
     /// </summary>
     public class TenPayUtil
     {
+        public static Random random = new Random();
+
         /// <summary>
         /// Noncestr
         /// </summary>
         /// <returns></returns>
         public static string GetNoncestr()
         {
-            Random random = new Random();
-            return MD5UtilHelper.GetMD5(random.Next(1000).ToString(), "GBK");
+            return EncryptHelper.GetMD5(Guid.NewGuid().ToString(), "GBK");
         }

         public static string GetTimestamp()
@@ -117,9 +121,12 @@
         /// <returns></returns>
         public static string BuildRandomStr(int length)
         {
-            Random rand = new Random();
+            int num;

-            int num = rand.Next();
+            lock (random)
+            {
+                num = random.Next();
+            }

             string str = num.ToString();


fixed finding themed view components

fixed finding themed view components

--- src/SimplCommerce.Infrastructure/Web/ViewComponentExtensions.cs
+++ src/SimplCommerce.Infrastructure/Web/ViewComponentExtensions.cs
@@ -26,7 +26,7 @@
             {
                 var themeViewPath = $"/Themes/{theme}{viewPath}";
                 var viewEngine = viewComponent.ViewContext.HttpContext.RequestServices.GetRequiredService<ICompositeViewEngine>();
-                var result = viewEngine.FindView(viewComponent.ViewContext, themeViewPath, isMainPage: false);
+                var result = viewEngine.GetView("", themeViewPath, isMainPage: false);
                 if (result.Success)
                 {
                     viewPath = themeViewPath;


Remove unnecessary string format

Remove unnecessary string format

--- src/Simple.OData.Client.UnitTests/Core/TypedFilterAsKeyTests.cs
+++ src/Simple.OData.Client.UnitTests/Core/TypedFilterAsKeyTests.cs
@@ -112,7 +112,7 @@
                 .Filter(x => x.OrderID == 1 && x.Quantity == 1 );
             var commandText = await command.GetCommandTextAsync();

-            var expected = string.Format("Order_Details?$filter=OrderID%20eq%201%20and%20Quantity%20eq%201", Uri.EscapeDataString("'"));
+            var expected = "Order_Details?$filter=OrderID%20eq%201%20and%20Quantity%20eq%201";
             Assert.Equal(expected, commandText);
         }

@@ -124,7 +124,7 @@
                 .Filter(x => x.ProductID == 1 && x.Quantity == 1);
             var commandText = await command.GetCommandTextAsync();

-            var expected = string.Format("Order_Details?$filter=ProductID%20eq%201%20and%20Quantity%20eq%201", Uri.EscapeDataString("'"));
+            var expected = "Order_Details?$filter=ProductID%20eq%201%20and%20Quantity%20eq%201";
             Assert.Equal(expected, commandText);
         }


Fix 28 failures in System.IO.Tests (#3434)

FileNotFoundException.FileName was setting to
something that wasn't a path.

--- src/System.Private.CoreLib/shared/System/IO/FileStream.WinRT.cs
+++ src/System.Private.CoreLib/shared/System/IO/FileStream.WinRT.cs
@@ -51,28 +51,10 @@
                 if (errorCode == Interop.Errors.ERROR_PATH_NOT_FOUND && _path.Length == PathInternal.GetRootLength(_path))
                     errorCode = Interop.Errors.ERROR_ACCESS_DENIED;

-                throw Win32Marshal.GetExceptionForWin32Error(errorCode, $"{_path} {options} {fAccess} {share} {mode}");
+                throw Win32Marshal.GetExceptionForWin32Error(errorCode, _path);
             }

             return fileHandle;
         }
-
-#if PROJECTN
-        // TODO: These internal methods should be removed once we start consuming updated CoreFX builds
-        public static FileStream InternalOpen(string path, int bufferSize = 4096, bool useAsync = true)
-        {
-            return new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.Read, bufferSize, useAsync);
-        }
-
-        public static FileStream InternalCreate(string path, int bufferSize = 4096, bool useAsync = true)
-        {
-            return new FileStream(path, FileMode.Create, FileAccess.Write, FileShare.Read, bufferSize, useAsync);
-        }
-
-        public static FileStream InternalAppend(string path, int bufferSize = 4096, bool useAsync = true)
-        {
-            return new FileStream(path, FileMode.Append, FileAccess.Write, FileShare.Read, bufferSize, useAsync);
-        }
-#endif
     }
 }


use Optional

use Optional

--- src/Workspaces/Core/Portable/Workspace/Solution/DocumentInfo.cs
+++ src/Workspaces/Core/Portable/Workspace/Solution/DocumentInfo.cs
@@ -97,11 +97,11 @@
         private DocumentInfo With(
             DocumentAttributes attributes = null,
             Optional<TextLoader> loader = default,
-            IDocumentServiceProvider documentServiceProvider = null)
+            Optional<IDocumentServiceProvider> documentServiceProvider = default)
         {
             var newAttributes = attributes ?? Attributes;
             var newLoader = loader.HasValue ? loader.Value : TextLoader;
-            var newDocumentServiceProvider = documentServiceProvider ?? DocumentServiceProvider;
+            var newDocumentServiceProvider = documentServiceProvider.HasValue ? documentServiceProvider.Value : DocumentServiceProvider;

             if (newAttributes == Attributes &&
                 newLoader == TextLoader &&


Don't use C#7 features.

Don't use C#7 features.

--- src/GitHub.App/Infrastructure/ExportWrappers.cs
+++ src/GitHub.App/Infrastructure/ExportWrappers.cs
@@ -27,17 +27,17 @@
     public class ExportedHttpListener : IHttpListener
     {
         readonly IHttpListener inner = new HttpListenerWrapper(new HttpListener());
-        public AuthenticationSchemes AuthenticationSchemes { get => inner.AuthenticationSchemes; set => inner.AuthenticationSchemes = value; }
-        public AuthenticationSchemeSelector AuthenticationSchemeSelectorDelegate { get => inner.AuthenticationSchemeSelectorDelegate; set => inner.AuthenticationSchemeSelectorDelegate = value; }
+        public AuthenticationSchemes AuthenticationSchemes { get { return inner.AuthenticationSchemes; } set { inner.AuthenticationSchemes = value; } }
+        public AuthenticationSchemeSelector AuthenticationSchemeSelectorDelegate { get { return inner.AuthenticationSchemeSelectorDelegate; } set { inner.AuthenticationSchemeSelectorDelegate = value; } }
         public ServiceNameCollection DefaultServiceNames => inner.DefaultServiceNames;
-        public ExtendedProtectionPolicy ExtendedProtectionPolicy { get => inner.ExtendedProtectionPolicy; set => inner.ExtendedProtectionPolicy = value; }
-        public HttpListener.ExtendedProtectionSelector ExtendedProtectionSelectorDelegate { get => inner.ExtendedProtectionSelectorDelegate; set => inner.ExtendedProtectionSelectorDelegate = value; }
-        public bool IgnoreWriteExceptions { get => inner.IgnoreWriteExceptions; set => inner.IgnoreWriteExceptions = value; }
+        public ExtendedProtectionPolicy ExtendedProtectionPolicy { get { return inner.ExtendedProtectionPolicy; } set { inner.ExtendedProtectionPolicy = value; } }
+        public HttpListener.ExtendedProtectionSelector ExtendedProtectionSelectorDelegate { get { return inner.ExtendedProtectionSelectorDelegate; } set { inner.ExtendedProtectionSelectorDelegate = value; } }
+        public bool IgnoreWriteExceptions { get { return inner.IgnoreWriteExceptions; } set { inner.IgnoreWriteExceptions = value; } }
         public bool IsListening => inner.IsListening;
         public ICollection<string> Prefixes => inner.Prefixes;
-        public string Realm { get => inner.Realm; set => inner.Realm = value; }
+        public string Realm { get { return inner.Realm; } set { inner.Realm = value; } }
         public HttpListenerTimeoutManager TimeoutManager => inner.TimeoutManager;
-        public bool UnsafeConnectionNtlmAuthentication { get => inner.UnsafeConnectionNtlmAuthentication; set => inner.UnsafeConnectionNtlmAuthentication = value; }
+        public bool UnsafeConnectionNtlmAuthentication { get { return inner.UnsafeConnectionNtlmAuthentication; } set { inner.UnsafeConnectionNtlmAuthentication = value; } }
         public void Abort() => inner.Abort();
         public IAsyncResult BeginGetContext(AsyncCallback callback, object state) => inner.BeginGetContext(callback, state);
         public void Close() => inner.Close();


Fix the registration of IConfiguration<>

--- src/Kephas.Core/Configuration/IConfiguration.cs
+++ src/Kephas.Core/Configuration/IConfiguration.cs
@@ -16,7 +16,7 @@
     /// Shared service contract for getting.
     /// </summary>
     /// <typeparam name="TSettings">Type of the settings.</typeparam>
-    [SharedAppServiceContract]
+    [SharedAppServiceContract(AsOpenGeneric = true)]
     public interface IConfiguration<out TSettings> : IExpando
     {
         /// <summary>


fix error code

fix error code

--- src/LkeServices/Transactions/OffchainService.cs
+++ src/LkeServices/Transactions/OffchainService.cs
@@ -660,19 +660,26 @@
             return await context.Build(async () =>
             {
                 var builder = new TransactionBuilder();
-                if (OpenAssetsHelper.IsBitcoin(asset.Id))
-                {
-                    var unspentOutputs = (await _bitcoinOutputsService.GetUncoloredUnspentOutputs(multisig.ToWif())).ToList();
-                    await _transactionBuildHelper.SendWithChange(builder, context, unspentOutputs, cashoutAddress, Money.FromUnit(amount, MoneyUnit.BTC),
-                            multisig);
-                }
-                else
-                {
-                    var assetId = new BitcoinAssetId(asset.BlockChainAssetId, _connectionParams.Network).AssetId;
-                    var unspentOutputs = (await _bitcoinOutputsService.GetColoredUnspentOutputs(multisig.ToWif(), assetId)).ToList();
-
-                    var sendAmount = new AssetMoney(assetId, amount, asset.MultiplierPower);
-                    _transactionBuildHelper.SendAssetWithChange(builder, context, unspentOutputs, cashoutAddress, sendAmount, multisig);
+                try
+                {
+                    if (OpenAssetsHelper.IsBitcoin(asset.Id))
+                    {
+                        var unspentOutputs = (await _bitcoinOutputsService.GetUncoloredUnspentOutputs(multisig.ToWif())).ToList();
+                        await _transactionBuildHelper.SendWithChange(builder, context, unspentOutputs, cashoutAddress, Money.FromUnit(amount, MoneyUnit.BTC),
+                                multisig);
+                    }
+                    else
+                    {
+                        var assetId = new BitcoinAssetId(asset.BlockChainAssetId, _connectionParams.Network).AssetId;
+                        var unspentOutputs = (await _bitcoinOutputsService.GetColoredUnspentOutputs(multisig.ToWif(), assetId)).ToList();
+
+                        var sendAmount = new AssetMoney(assetId, amount, asset.MultiplierPower);
+                        _transactionBuildHelper.SendAssetWithChange(builder, context, unspentOutputs, cashoutAddress, sendAmount, multisig);
+                    }
+                }
+                catch (BackendException e) when (e.Code == ErrorCode.NotEnoughAssetAvailable || e.Code == ErrorCode.NotEnoughBitcoinAvailable)
+                {
+                    throw new BackendException("Client amount in channel is low than required", ErrorCode.NotEnoughtClientFunds);
                 }
                 await _transactionBuildHelper.AddFee(builder, context);
                 var tr = builder.BuildTransaction(true);


Corrected font extension check (#491)

Corrected font extension check (#491)

--- src/Magick.NET/Shared/Drawables/DrawableFont.cs
+++ src/Magick.NET/Shared/Drawables/DrawableFont.cs
@@ -19,7 +19,7 @@
     /// </summary>
     public sealed class DrawableFont : IDrawable, IDrawingWand
     {
-        private static readonly string[] _FontExtensions = new string[] { ".ttf", ".tcc", ".pfb", ".pfm", ".otf" };
+        private static readonly string[] _FontExtensions = new string[] { ".ttf", ".ttc", ".pfb", ".pfm", ".otf" };

         /// <summary>
         /// Initializes a new instance of the <see cref="DrawableFont"/> class.


Use a host specified param name variant (if available) instead of canonical in the missing required param message

--- src/Microsoft.TemplateEngine.Cli/New3Command.cs
+++ src/Microsoft.TemplateEngine.Cli/New3Command.cs
@@ -337,7 +337,21 @@
                     Reporter.Error.WriteLine(string.Format(LocalizableStrings.CreateFailed, resultTemplateName, instantiateResult.Message).Bold().Red());
                     break;
                 case CreationResultStatus.MissingMandatoryParam:
-                    Reporter.Error.WriteLine(string.Format(LocalizableStrings.MissingRequiredParameter, instantiateResult.Message, resultTemplateName).Bold().Red());
+                    //Reporter.Error.WriteLine(string.Format(LocalizableStrings.MissingRequiredParameter, instantiateResult.Message, resultTemplateName).Bold().Red());
+
+                    if (string.Equals(instantiateResult.Message, "--name", StringComparison.Ordinal))
+                    {
+                        Reporter.Error.WriteLine(string.Format(LocalizableStrings.MissingRequiredParameter, instantiateResult.Message, resultTemplateName).Bold().Red());
+                    }
+                    else
+                    {
+                        IReadOnlyList<string> missingParamNamesCanonical = instantiateResult.Message.Split(new[] { ',' })
+                            .Select(x => _commandInput.VariantsForCanonical(x.Trim())
+                                                        .DefaultIfEmpty(x.Trim()).First())
+                            .ToList();
+                        string fixedMessage = string.Join(", ", missingParamNamesCanonical);
+                        Reporter.Error.WriteLine(string.Format(LocalizableStrings.MissingRequiredParameter, fixedMessage, resultTemplateName).Bold().Red());
+                    }
                     break;
                 case CreationResultStatus.OperationNotSpecified:
                     break;


when request is cancelled, need to cancel the data task as well as signal the caller

--- src/ModernHttpClient/iOS/NSUrlSessionHandler.cs
+++ src/ModernHttpClient/iOS/NSUrlSessionHandler.cs
@@ -107,7 +107,10 @@
             cancellationToken.ThrowIfCancellationRequested();

             var ret = new TaskCompletionSource<HttpResponseMessage>();
-            cancellationToken.Register(() => ret.TrySetCanceled());
+            cancellationToken.Register(() => {
+                op.Cancel();
+                ret.TrySetCanceled();
+            });

             lock (inflightRequests) {
                 inflightRequests[op] = new InflightOperation() {


Fix unrelated indentation issue

Fix unrelated indentation issue

--- src/ModernHttpClient/iOS/NSUrlSessionHandler.cs
+++ src/ModernHttpClient/iOS/NSUrlSessionHandler.cs
@@ -307,13 +307,13 @@

             if (isCompleted && position < maxLength) {
                 // NB: This solves a rare deadlock
-		//
+                //
                 // 1. ReadAsync called (waiting for lock release)
                 // 2. AddByteArray called (release lock)
                 // 3. AddByteArray called (release lock)
                 // 4. Complete called (release lock the last time)
-		// 5. ReadAsync called (lock released at this point, the method completed successfully)
-		// 6. ReadAsync called (deadlock on LockAsync(), because the lock is block, and there is no way to release it)
+                // 5. ReadAsync called (lock released at this point, the method completed successfully)
+                // 6. ReadAsync called (deadlock on LockAsync(), because the lock is block, and there is no way to release it)
                 //
                 // Current condition forces the lock to be released in the end of 5th point


Documentation tweak

Documentation tweak

--- src/Splunk.Client/Splunk/Client/IApplication.cs
+++ src/Splunk.Client/Splunk/Client/IApplication.cs
@@ -145,7 +145,7 @@
         /// disabling an <see cref="Application"/>.
         /// </remarks>
         /// <value>
-        /// <c>true</c> if state change requires restart, <c>false</c> if not.
+        /// <c>true</c> if a state change requires a restart, <c>false</c> if not.
         /// </value>
         bool StateChangeRequiresRestart
         { get; }


Add GetDefaultConnectionString static method to the storage

--- src/Spreads.Extensions/Storage/SeriesStorage.cs
+++ src/Spreads.Extensions/Storage/SeriesStorage.cs
@@ -50,7 +50,11 @@

         private static readonly string _defaultPath = Bootstrap.Bootstrapper.Instance.DataFolder;
         public static SeriesStorage GetDefault(string filename = "default.db") {
-            return new SeriesStorage($"Filename={Path.Combine(_defaultPath, filename)}");
+            return new SeriesStorage(GetDefaultConnectionString(filename));
+        }
+
+        public static string GetDefaultConnectionString(string filename = "default.db") {
+            return $"Filename={Path.Combine(_defaultPath, filename)}";
         }

         public SqliteConnection Connection


chore: Remove empty file. (#2516)

chore: Remove empty file. (#2516)


Fix #2345 , split test for non-throwing base enumerable.

--- src/System.Linq.Parallel/tests/ExchangeTests.cs
+++ src/System.Linq.Parallel/tests/ExchangeTests.cs
@@ -5,6 +5,7 @@
 using System.Collections.Concurrent;
 using System.Collections.Generic;
 using System.Linq;
+using System.Threading;
 using Xunit;

 namespace Test
@@ -131,22 +132,26 @@
         }

         [Theory]
-        [MemberData("MergeData", (object)(new int[] { 16, 1024 }))]
-        [MemberData("ThrowOnCount_AllMergeOptions_MemberData", (object)(new int[] { 16, 1024 }))]
+        [MemberData("ThrowOnCount_AllMergeOptions_MemberData", (object)(new int[] { 4, 8 }))]
         // FailingMergeData has enumerables that throw errors when attempting to perform the nth enumeration.
         // This test checks whether the query runs in a pipelined or buffered fashion.
         public static void Merge_Ordered_Pipelining(Labeled<ParallelQuery<int>> labeled, int count, ParallelMergeOptions options)
         {
-            Assert.Equal(0, labeled.Item.WithMergeOptions(options).Select(x => x).First());
-        }
-
-        [Theory]
-        [OuterLoop]
-        [MemberData("MergeData", (object)(new int[] { 1024 * 4, 1024 * 1024 }))]
-        [MemberData("ThrowOnCount_AllMergeOptions_MemberData", (object)(new int[] { 1024 * 4, 1024 * 1024 }))]
-        public static void Merge_Ordered_Pipelining_Longrunning(Labeled<ParallelQuery<int>> labeled, int count, ParallelMergeOptions options)
-        {
-            Merge_Ordered_Pipelining(labeled, count, options);
+            Assert.Equal(0, labeled.Item.WithDegreeOfParallelism(count - 1).WithMergeOptions(options).First());
+        }
+
+        [Theory]
+        [MemberData("MergeData", (object)(new int[] { 4, 8 }))]
+        // This test checks whether the query runs in a pipelined or buffered fashion.
+        public static void Merge_Ordered_Pipelining_Select(Labeled<ParallelQuery<int>> labeled, int count, ParallelMergeOptions options)
+        {
+            int countdown = count;
+            Func<int, int> down = i =>
+            {
+                if (Interlocked.Decrement(ref countdown) == 0) throw new DeliberateTestException();
+                return i;
+            };
+            Assert.Equal(0, labeled.Item.WithDegreeOfParallelism(count - 1).WithMergeOptions(options).Select(down).First());
         }

         [Theory]


Avoid a boxing allocation in UriBuilder.ToString

--- src/System.Private.Uri/src/System/UriBuilder.cs
+++ src/System.Private.Uri/src/System/UriBuilder.cs
@@ -416,7 +416,7 @@
                     + ((_password.Length > 0) ? (":" + _password) : string.Empty)
                     + ((_username.Length > 0) ? "@" : string.Empty)
                     + _host
-                    + (((_port != -1) && (_host.Length > 0)) ? (":" + _port) : string.Empty)
+                    + (((_port != -1) && (_host.Length > 0)) ? (":" + _port.ToString()) : string.Empty)
                     + (((_host.Length > 0) && (_path.Length != 0) && (_path[0] != '/')) ? "/" : string.Empty) + _path
                     + _query
                     + _fragment;


Initializing outputs

Initializing outputs

--- src/Take.Blip.Builder/Diagnostics/StateTrace.cs
+++ src/Take.Blip.Builder/Diagnostics/StateTrace.cs
@@ -9,6 +9,7 @@
         {
             InputActions = new List<ActionTrace>();
             OutputActions = new List<ActionTrace>();
+            Outputs = new List<OutputTrace>();
         }

         public string Id { get; set; }


Core.Resolution - fix concurrency issues

--- src/Umbraco.Core/ObjectResolution/Resolution.cs
+++ src/Umbraco.Core/ObjectResolution/Resolution.cs
@@ -126,7 +126,7 @@
         /// <remarks>To be used in unit tests.</remarks>
         internal static void Reset()
         {
-            LogHelper.Debug(typeof(DirtyBackdoor), "Resetting resolution");
+            LogHelper.Debug(typeof(Resolution), "Resetting resolution");

             using (new WriteLock(ConfigurationLock))
             {


Removed the "type" attribute from the `<script>` tags

With HTML5, it is no longer required, (the browser assumes "text/javascript"),
see: https://www.w3.org/TR/html5/semantics-scripting.html#script-processing-model

--- src/Umbraco.Web.UI/umbraco/Views/Default.cshtml
+++ src/Umbraco.Web.UI/umbraco/Views/Default.cshtml
@@ -89,19 +89,19 @@

     @Html.BareMinimumServerVariablesScript(Url, Url.Action("ExternalLogin", "BackOffice", new { area = ViewBag.UmbracoPath }))

-    <script type="text/javascript">
+    <script>
         document.angularReady = function(app) {
             @Html.AngularValueExternalLoginInfoScript((IEnumerable<string>)ViewBag.ExternalSignInError)
             @Html.AngularValueResetPasswordCodeInfoScript(ViewData["PasswordResetCode"])
         }
     </script>

-    <script type="text/javascript" src="lib/rgrove-lazyload/lazyload.js"></script>
-    <script type="text/javascript" src="@Url.GetUrlWithCacheBust("Application", "BackOffice")"></script>
+    <script src="lib/rgrove-lazyload/lazyload.js"></script>
+    <script src="@Url.GetUrlWithCacheBust("Application", "BackOffice")"></script>

     @if (isDebug)
     {
-        <script type="text/javascript" src="lib/jquery/jquery.min.js"></script>
+        <script src="lib/jquery/jquery.min.js"></script>
         @Html.RenderProfiler()
     }
 </body>


defensive coding around a possible null reference.

--- cocos2d/base_nodes/CCNode.cs
+++ cocos2d/base_nodes/CCNode.cs
@@ -814,9 +814,12 @@
         public virtual void RemoveAllChildrenWithCleanup(bool cleanup)
         {
             // not using detachChild improves speed here
-            if (m_pChildren != null)
-            {
-                m_pChildrenByTag.Clear();
+            if (m_pChildren != null && m_pChildren.Count > 0)
+            {
+                if (m_pChildrenByTag != null)
+                {
+                    m_pChildrenByTag.Clear();
+                }
                 CCNode[] elements = m_pChildren.Elements;
                 for (int i = 0, count = m_pChildren.count; i < count; i++)
                 {


Fix for world transform using the first parent transform twice.

--- cocos2d/base_nodes/CCNode.cs
+++ cocos2d/base_nodes/CCNode.cs
@@ -1446,15 +1446,12 @@

         public CCAffineTransform NodeToWorldTransform()
         {
-            CCAffineTransform t = NodeToParentTransform();
-
-            CCNode p = m_pParent;
-            while (p != null)
+            CCAffineTransform t = CCAffineTransform.Identity;
+
+            for (CCNode p = m_pParent; p != null; p = p.Parent)
             {
                 t.Concat(p.NodeToParentTransform());
-                p = p.Parent;
-            }
-
+            }
             return t;
         }


un-break pulse guiding

un-break pulse guiding

--- NexStar/PulseGuide.cs
+++ NexStar/PulseGuide.cs
@@ -43,15 +43,15 @@
             RaTimer = new System.Timers.Timer();
             DecTimer = new System.Timers.Timer();
             GuideEnabled = true;
-#if DEBUG
-            RaStopWatch = new Stopwatch();
-            DecStopWatch = new Stopwatch();
             RaTimer.Enabled = false;
             DecTimer.Enabled = false;
             RaTimer.AutoReset = false;
             DecTimer.AutoReset = false;
             RaTimer.Elapsed += new ElapsedEventHandler(RaTimer_Elapsed);
             DecTimer.Elapsed += new ElapsedEventHandler(DecTimer_Elapsed);
+#if DEBUG
+            RaStopWatch = new Stopwatch();
+            DecStopWatch = new Stopwatch();
             RaStopWatch.Reset();
             DecStopWatch.Reset();
             RaDiffList = new List<double>();


Added case sensitive property for RS4.

Added case sensitive property for RS4.

--- NtApiDotNet/NtFile.cs
+++ NtApiDotNet/NtFile.cs
@@ -517,6 +517,11 @@
         FileDispositionInformationEx,
         FileRenameInformationEx,
         FileRenameInformationExBypassAccessCheck,
+        FileDesiredStorageClassInformation,
+        FileStatInformation,
+        FileMemoryPartitionInformation,
+        FileStatLxInformation,
+        FileCaseSensitiveInformation,
         FileMaximumInformation
     }

@@ -3218,22 +3223,31 @@

         private T QueryFileFixed<T>(FileInformationClass info_class) where T : new()
         {
+            return QueryFileFixed<T>(info_class, true).Result;
+        }
+
+        private NtResult<T> QueryFileFixed<T>(FileInformationClass info_class, bool throw_on_error) where T : new()
+        {
             using (var buffer = new SafeStructureInOutBuffer<T>())
             {
                 IoStatus status = new IoStatus();
-                NtSystemCalls.NtQueryInformationFile(Handle, status, buffer,
-                    buffer.Length, info_class).ToNtException();
-                return buffer.Result;
+                return NtSystemCalls.NtQueryInformationFile(Handle, status, buffer,
+                    buffer.Length, info_class).CreateResult(throw_on_error, () => buffer.Result);
             }
         }

         private void SetFileFixed<T>(T value, FileInformationClass info_class) where T : new()
         {
+            SetFileFixed(value, info_class, true);
+        }
+
+        private NtStatus SetFileFixed<T>(T value, FileInformationClass info_class, bool throw_on_error) where T : new()
+        {
             using (var buffer = value.ToBuffer())
             {
                 IoStatus io_status = new IoStatus();
-                NtSystemCalls.NtSetInformationFile(Handle, io_status,
-                    buffer, buffer.Length, info_class).ToNtException();
+                return NtSystemCalls.NtSetInformationFile(Handle, io_status,
+                    buffer, buffer.Length, info_class).ToNtException(throw_on_error);
             }
         }

@@ -3732,6 +3746,28 @@
                 return QueryFileFixed<bool>(FileInformationClass.FileIsRemoteDeviceInformation);
             }
         }
+
+        /// <summary>
+        /// Get or set whether this file/directory is case sensitive.
+        /// </summary>
+        public bool CaseSensitive
+        {
+            get
+            {
+                var result = QueryFileFixed<int>(FileInformationClass.FileCaseSensitiveInformation, false);
+                if (!result.IsSuccess)
+                {
+                    return false;
+                }
+
+                return (result.Result & 1) == 1;
+            }
+
+            set
+            {
+                SetFileFixed(value ? 1 : 0, FileInformationClass.FileCaseSensitiveInformation);
+            }
+        }
     }

     /// <summary>
@@ -3749,8 +3785,7 @@
             UnicodeStringOut nt_name = new UnicodeStringOut();
             try
             {
-                IntPtr short_path;
-                NtRtl.RtlDosPathNameToRelativeNtPathName_U_WithStatus(filename, out nt_name, out short_path, null).ToNtException();
+                NtRtl.RtlDosPathNameToRelativeNtPathName_U_WithStatus(filename, out nt_name, out IntPtr short_path, null).ToNtException();
                 return nt_name.ToString();
             }
             finally
@@ -3773,8 +3808,7 @@
             RtlRelativeName relative_name = new RtlRelativeName();
             try
             {
-                IntPtr short_path;
-                NtRtl.RtlDosPathNameToRelativeNtPathName_U_WithStatus(filename, out nt_name, out short_path, relative_name).ToNtException();
+                NtRtl.RtlDosPathNameToRelativeNtPathName_U_WithStatus(filename, out nt_name, out IntPtr short_path, relative_name).ToNtException();
                 if (relative_name.RelativeName.Buffer != IntPtr.Zero)
                 {
                     return new ObjectAttributes(relative_name.RelativeName.ToString(), AttributeFlags.CaseInsensitive,


Add the ability to call NtSetInformationFile with FileRenameInformationEx information class.

--- NtApiDotNet/NtFile.cs
+++ NtApiDotNet/NtFile.cs
@@ -363,6 +363,25 @@
     struct FileDispositionInformationEx
     {
         public FileDispositionInformationExFlags Flags;
+    }
+
+    [Flags]
+    public enum FileRenameInformationExFlags : uint
+    {
+        None = 0,
+        ReplaceIfExists = 0x00000001,
+        PosixSemantics = 0x00000002,
+        SuppressPinStateInheritance = 0x00000004,
+    }
+
+    [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
+    [DataStart("FileName")]
+    public class FileRenameInformationEx
+    {
+        public FileRenameInformationExFlags Flags;
+        public IntPtr RootDirectory;
+        public int FileNameLength;
+        public char FileName; // Unused, place holder for start of data.
     }

     [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
@@ -2449,6 +2468,22 @@
             SetFileFixed(new FileDispositionInformationEx() { Flags = flags }, FileInformationClass.FileDispositionInformationEx);
         }

+        private void DoRenameEx(string filename, NtFile root, FileRenameInformationExFlags flags)
+        {
+            FileRenameInformationEx information = new FileRenameInformationEx();
+            information.Flags = flags;
+            information.RootDirectory = root != null ? root.Handle.DangerousGetHandle() : IntPtr.Zero;
+            char[] chars = filename.ToCharArray();
+            information.FileNameLength = chars.Length * 2;
+            using (var buffer = information.ToBuffer(information.FileNameLength, true))
+            {
+                IoStatus iostatus = new IoStatus();
+                buffer.Data.WriteArray(0, chars, 0, chars.Length);
+                NtSystemCalls.NtSetInformationFile(Handle, iostatus, buffer,
+                        buffer.Length, FileInformationClass.FileRenameInformationEx).ToNtException();
+            }
+        }
+
         private void DoLinkRename(FileInformationClass file_info, string linkname, NtFile root, bool replace_if_exists)
         {
             FileLinkRenameInformation link = new FileLinkRenameInformation();
@@ -2563,6 +2598,17 @@
             {
                 file.Rename(new_name);
             }
+        }
+
+        /// <summary>
+        /// Rename (extended Windows version) this file with an absolute path.
+        /// </summary>
+        /// <param name="new_name">The target absolute NT path.</param>
+        /// <param name="flags">The flags associated to FileRenameInformationEx.</param>
+        /// <exception cref="NtException">Thrown on error.</exception>
+        public void RenameEx(string new_name, FileRenameInformationExFlags flags)
+        {
+            DoRenameEx(new_name, null, flags);
         }

         /// <summary>


made benchmark for checking speed of cyk

--- ConsolePlayground/Program.cs
+++ ConsolePlayground/Program.cs
@@ -10,7 +10,8 @@
 	// A console app for playing around
 	class Program {
 		static void Main(string[] args) {
-			CFGParser.Production(@"<X> -> <X0> <X1> 'asdf as_-""fw' <Z23X>");
+
+			Benchmark();

 			// Readme();

@@ -19,6 +20,45 @@

 			Console.Read();
 		}
+
+		static void Benchmark() {
+			// CFGParser.Production(@"<X> -> <X0> <X1> 'asdf as_-""fw' <Z23X>");
+			int _numNonterminals = 10;
+			int _numProductions = 100;
+			int _numTerminals = 5;
+			int _maxLength = 4;
+			int _numGrammars = 40;
+
+			var range = Enumerable.Range(0, _numTerminals);
+			var terminals = new List<Terminal>(range.Select((x) => Terminal.Of("x" + x)));
+			var preparedSentences = new List<Sentence>();
+			for (int length = 1; length <= _maxLength; length++) {
+				foreach (var target in Helpers.CombinationsWithRepetition(terminals, length)) {
+					var sentence = new Sentence(target);
+					preparedSentences.Add(sentence);
+				}
+			}
+
+			var randg = new CNFRandom();
+			var preparedGrammars = new List<CNFGrammar>();
+			for (int i = 0; i < _numGrammars; i++) {
+				var g = randg.Next(_numNonterminals, _numProductions, terminals);
+				preparedGrammars.Add(g);
+			}
+
+			var sw = Stopwatch.StartNew();
+			foreach (var g in preparedGrammars) {
+				// Console.WriteLine(g);
+				foreach (var sentence in preparedSentences) {
+					var chance = g.Cyk(sentence);
+					// Console.WriteLine("{0}: {1}", sentence, chance);
+				}
+			}
+			sw.Stop();
+			Console.WriteLine("Elapsed: {0}s", sw.Elapsed.TotalMilliseconds / 1000.0);
+			Console.WriteLine("Per CYK: {0}ms", sw.Elapsed.TotalMilliseconds / (_numGrammars * preparedSentences.Count));
+		}
+
 		static void Readme() {
 			// S -> aSa | bSb | ε
 			var productions = new List<BaseProduction> {


Fixed notify call arg

Fixed notify call arg

--- Test2d/Core/BaseShape.cs
+++ Test2d/Core/BaseShape.cs
@@ -125,7 +125,7 @@
                 if (value != _record)
                 {
                     _record = value;
-                    Notify("Data");
+                    Notify("Record");
                 }
             }
         }


remove code nodes from xml

remove code nodes from xml

--- TiaGitHandler/Program.cs
+++ TiaGitHandler/Program.cs
@@ -313,7 +313,11 @@
                                         var nodes = xmlDoc2.SelectNodes("//SW.Blocks.CompileUnit");
                                         var node = nodes[0];
                                         node.InnerXml = "";
-                                        //node.ParentNode.RemoveChild(node);
+                                        var parent = node.ParentNode;
+                                        foreach (var nd in nodes.Cast<XmlNode>().Skip(1).ToList())
+                                        {
+                                            parent.RemoveChild(nd);
+                                        }
                                     }
                                     catch
                                     {


Make the alive setter public

Make the alive setter public

--- Tron/Tron/CarData/Car.cs
+++ Tron/Tron/CarData/Car.cs
@@ -82,7 +82,7 @@
         /// <summary>
         /// Gets or sets a value indicating whether the car has crashed.
         /// </summary>
-        public bool Alive { get; protected set; }
+        public bool Alive { get; set; }

         /// <summary>
         /// Gets or sets the amount of victories for this car.


Removed debug output from DComponent.Clone

--- Uiml/Peers/DComponent.cs
+++ Uiml/Peers/DComponent.cs
@@ -58,35 +58,23 @@

         public virtual object Clone()
         {
-            Console.WriteLine("Debug 1");
             DComponent clone = new DComponent();
-            Console.WriteLine("Debug 2");
             clone.CopyAttributesFrom(this);
-            Console.WriteLine("Debug 3");
             clone.m_mapsTo = m_mapsTo;
-            Console.WriteLine("Debug 4");
             if(m_location != null)
             {
                 clone.m_location = (Location)m_location.Clone();
             }
-            Console.WriteLine("Debug 5");

             if(m_children != null)
             {
-                Console.WriteLine("Debug 6");
                 clone.m_children = new ArrayList();
-                Console.WriteLine("Debug 7");
                 for(int i = 0; i < m_children.Count; i++)
                 {
-                    Console.WriteLine("Debug 8");
                     IUimlElement element = (IUimlElement)m_children[i];
-                    Console.WriteLine("Debug 9");
                     clone.m_children.Add(element.Clone());
-                    Console.WriteLine("Debug 10");
                 }
             }
-            Console.WriteLine("Debug 11");
-

             return clone;
         }