Only one return value and some fixes.

Only one return value and some fixes.

* Always store in root folder - except when a file system with sub filders is used
* The domain is stripped from the user name

--- src/FubarDev.WebDavServer.Props.Store.TextFile/TextFilePropertyStoreFactory.cs
+++ src/FubarDev.WebDavServer.Props.Store.TextFile/TextFilePropertyStoreFactory.cs
@@ -49,30 +49,30 @@
         /// <inheritdoc />
         public IPropertyStore Create(IFileSystem fileSystem)
         {
+            string fileName = ".properties";
+            bool storeInRoot;
             string rootPath;
             ILocalFileSystem localFs;
             if (_options.StoreInTargetFileSystem && (localFs = fileSystem as ILocalFileSystem) != null)
             {
                 rootPath = localFs.RootDirectoryPath;
-                var storeInRoot = !localFs.HasSubfolders;
+                storeInRoot = !localFs.HasSubfolders;
                 if (storeInRoot)
                 {
                     var userName = _webDavContext.User.Identity.IsAuthenticated
                         ? _webDavContext.User.Identity.Name
                         : "anonymous";
-                    return new TextFilePropertyStore(
-                        _options,
-                        _deadPropertyFactory,
-                        rootPath,
-                        true,
-                        $"{userName}.json",
-                        _logger);
+                    var p = userName.IndexOf('\\');
+                    if (p != -1)
+                        userName = userName.Substring(p + 1);
+                    fileName = $"{userName}.json";
                 }
             }
             else if (string.IsNullOrEmpty(_options.RootFolder))
             {
                 var userHomePath = Utils.SystemInfo.GetUserHomePath(_webDavContext.User);
                 rootPath = Path.Combine(userHomePath, ".webdav");
+                storeInRoot = true;
             }
             else
             {
@@ -80,11 +80,12 @@
                                    ? _webDavContext.User.Identity.Name
                                    : "anonymous";
                 rootPath = Path.Combine(_options.RootFolder, userName);
+                storeInRoot = true;
             }

             Directory.CreateDirectory(rootPath);

-            return new TextFilePropertyStore(_options, _deadPropertyFactory, rootPath, false, ".properties", _logger);
+            return new TextFilePropertyStore(_options, _deadPropertyFactory, rootPath, storeInRoot, fileName, _logger);
         }
     }
 }


Added comments

Added comments

--- source2/IL2PCU/Cosmos.IL2CPU.X86/X86/SpecialDebug/DebugStub.cs
+++ source2/IL2PCU/Cosmos.IL2CPU.X86/X86/SpecialDebug/DebugStub.cs
@@ -54,8 +54,7 @@
             Return();
         }

-        protected void BreakOnAddress()
-        {
+        protected void BreakOnAddress() {
             Label = "DebugStub_BreakOnAddress";
             PushAll32();

@@ -65,13 +64,15 @@
             //Jump("DebugStub_BreakOnAddress2");
             //new Sub { DestinationReg = RegistersEnum.EDI, SourceValue = 3 };

-            // read address
+            // Read address to stack
             Call("ReadByteFromComPort");
             Call("ReadByteFromComPort");
             Call("ReadByteFromComPort");
             Call("ReadByteFromComPort");

+            // Pop of 4 bytes read from port to stack as EAX
             new Pop { DestinationReg = RegistersEnum.EAX };
+            // Set it to our breakpoint address
             Memory["DebugBreakpointAddress", 32] = EAX;

             PopAll32();
@@ -344,7 +345,7 @@
             AL.Compare((byte)Command.Break);
                 JumpIf(Flags.Equal, "DebugStub_Break");
             AL.Compare((byte)Command.BreakOnAddress);
-            JumpIf(Flags.Equal, "DebugStub_BreakOnAddress");
+                JumpIf(Flags.Equal, "DebugStub_BreakOnAddress");

             Label = "DebugStub_Executing_Exit";
             Return();


pass token type hint

pass token type hint

--- src/IdentityModel.AspNetCore.OAuth2Introspection/OAuth2IntrospectionHandler.cs
+++ src/IdentityModel.AspNetCore.OAuth2Introspection/OAuth2IntrospectionHandler.cs
@@ -60,6 +60,7 @@
             var response = await introspectionClient.SendAsync(new IntrospectionRequest
             {
                 Token = token,
+                TokenTypeHint = OidcConstants.TokenTypes.AccessToken,
                 ClientId = Options.ScopeName,
                 ClientSecret = Options.ScopeSecret
             }).ConfigureAwait(false);


allow chaining in ConfigureJoinExternalLogins

--- src/JoinRpg.Portal/Infrastructure/Authentication/AuthenticationConfigurator.cs
+++ src/JoinRpg.Portal/Infrastructure/Authentication/AuthenticationConfigurator.cs
@@ -11,7 +11,7 @@
 {
     internal static class AuthenticationConfigurator
     {
-        public static void ConfigureJoinExternalLogins(this AuthenticationBuilder authBuilder, IConfigurationSection configSection)
+        public static AuthenticationBuilder ConfigureJoinExternalLogins(this AuthenticationBuilder authBuilder, IConfigurationSection configSection)
         {
             var googleConfig = configSection.GetSection("Google").Get<OAuthAuthenticationOptions>();

@@ -36,6 +36,8 @@
                       SetCommonProperties(options, vkConfig);
                   });
             }
+
+            return authBuilder;

             static void SetCommonProperties(OAuthOptions options, OAuthAuthenticationOptions config)
             {


Ensure that serialized claims are less than 1000 bytes and serilize it to string during UserRecord serialization

--- FirebaseAdmin/FirebaseAdmin/Auth/UserRecord.cs
+++ FirebaseAdmin/FirebaseAdmin/Auth/UserRecord.cs
@@ -12,9 +12,11 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.

+using Google.Apis.Json;
 using Newtonsoft.Json;
 using System;
 using System.Collections.Generic;
+using System.Text;

 namespace FirebaseAdmin.Auth
 {
@@ -44,7 +46,7 @@
         /// <summary>
         /// Returns custom claims set on this user.
         /// </summary>
-        [JsonProperty("customAttributes")]
+        [JsonIgnore]
         public IReadOnlyDictionary<string, object> CustomClaims
         {
             get => _customClaims;
@@ -54,6 +56,9 @@
                 _customClaims = value;
             }
         }
+
+        [JsonProperty("customAttributes")]
+        internal string CustomClaimsString => SerializeClaims(CustomClaims);

         /// <summary>
         /// Checks if the given user ID is valid.
@@ -76,7 +81,8 @@
         /// Checks if the given set of custom claims are valid.
         /// </summary>
         /// <param name="customClaims">The custom claims. Claim names must
-        /// not be null or empty and must not be reserved.</param>
+        /// not be null or empty and must not be reserved and the serialized
+        /// claims have to be less than 1000 bytes.</param>
         public static void CheckCustomClaims(IReadOnlyDictionary<string, object> customClaims)
         {
             if (customClaims == null)
@@ -95,6 +101,18 @@
                     throw new ArgumentException($"Claim {key} is reserved and cannot be set");
                 }
             }
+
+            var customClaimsString = SerializeClaims(customClaims);
+            var byteCount = Encoding.Unicode.GetByteCount(customClaimsString);
+            if(byteCount >= 1000)
+            {
+                throw new ArgumentException($"Claims have to be less than 1000 bytes when serialized");
+            }
+        }
+
+        private static string SerializeClaims(IReadOnlyDictionary<string, object> claims)
+        {
+            return NewtonsoftJsonSerializer.Instance.Serialize(claims);
         }
     }
 }


Iterate over all formations and find best permutation.

Print out a message after the permutations for a formation have been
collected, then sort them and print out the top few.

--- BrigadeRouletteConsole/Program.cs
+++ BrigadeRouletteConsole/Program.cs
@@ -434,9 +434,20 @@

             int num = 0;
             int numToPrint = 5;
-            var brigadeFormationPermuations = GetBrigadeFormationPermutations(phlebotomistRepository, familiarWinPercents,
-                fiveFamiliarBrigadeFormations.FirstOrDefault(), _includeReserve);
-            foreach (var permutation in brigadeFormationPermuations.OrderByDescending(x => x.WinPercent))
+            //var brigadeFormationPermutations = GetBrigadeFormationPermutations(phlebotomistRepository, familiarWinPercents,
+            //    //fiveFamiliarBrigadeFormations.FirstOrDefault(), _includeReserve);
+            //    fiveFamiliarBrigadeFormations.Where(x => string.Equals(x.Name, "5-Shield")).FirstOrDefault(), _includeReserve);
+
+            var brigadeFormationPermutations = new List<BrigadeFormationWithFamiliars>();
+            foreach (var brigadeFormation in fiveFamiliarBrigadeFormations)
+            {
+                brigadeFormationPermutations.AddRange(GetBrigadeFormationPermutations(phlebotomistRepository, familiarWinPercents,
+                    brigadeFormation, _includeReserve));
+                System.Console.WriteLine("Finished permuting formation '{0}'.  Current number of permutations: {1}.",
+                    brigadeFormation.Name, brigadeFormationPermutations.Count);
+            }
+
+            foreach (var permutation in brigadeFormationPermutations.OrderByDescending(x => x.WinPercent))
             {
                 System.Console.WriteLine("{0}: {1}%", num, permutation.WinPercent);
                 System.Console.WriteLine(permutation.ToString());


Moved RegexCode.OpcodeSize() outside of #if DEBUG declaration

--- Flatbox.RegularExpressions/NetStd/RegexCode.cs
+++ Flatbox.RegularExpressions/NetStd/RegexCode.cs
@@ -153,7 +153,6 @@
             }
         }

-#if DEBUG
         internal static int OpcodeSize(int opcode)
         {
             opcode &= Mask;
@@ -212,8 +211,9 @@
                 default:
                     throw new ArgumentException("");
             }
-        }
-
+        }
+
+#if DEBUG
         private static readonly string[] CodeStr = new string[]
         {
             "Onerep", "Notonerep", "Setrep",


implement GenerateUniqueFilename method

implement GenerateUniqueFilename method

--- FonctionsUtiles.Fred.Csharp/FunctionsString.cs
+++ FonctionsUtiles.Fred.Csharp/FunctionsString.cs
@@ -1720,6 +1720,7 @@

       string result = string.Empty;
       // TODO to complete
+      // string[26 + 26 + 10 + 10] 26 lower case + 26 upper case + 10 digits + 10 special characters
       string[] charactersToBeSearchFrom = new string[26 + 26 + 10 + 10];

       return result;


The PingMissed event was not in the IDeadPeerDetector interface

--- src/Abc.Zebus.Directory/DeadPeerDetection/IDeadPeerDetector.cs
+++ src/Abc.Zebus.Directory/DeadPeerDetection/IDeadPeerDetector.cs
@@ -7,6 +7,7 @@
         event Action PersistenceDownDetected;
         event Action<PeerId, DateTime> PeerDownDetected;
         event Action<PeerId, DateTime> PeerRespondingDetected;
+        event Action<PeerId, DateTime> PingMissed;

         Action<Exception> ExceptionHandler { get; set; }


Updatd FacetFilter.cs to 4.0.2 compatibility.

--- src/BoboBrowse.Net/BoboBrowse.Net/Facets/Filter/FacetFilter.cs
+++ src/BoboBrowse.Net/BoboBrowse.Net/Facets/Filter/FacetFilter.cs
@@ -17,7 +17,7 @@
 //* 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.Filter
 {
     using BoboBrowse.Net.DocIdSet;
@@ -28,8 +28,6 @@

     public class FacetFilter : RandomAccessFilter
     {
-        //private static long serialVersionUID = 1L; // NOT USED
-
         protected readonly IFacetHandler _facetHandler;
         protected readonly string _value;

@@ -90,6 +88,11 @@
                 }
                 return NextDoc();
             }
+
+            public override long Cost()
+            {
+                return 0;
+            }
         }

         public override RandomAccessDocIdSet GetRandomAccessDocIdSet(BoboSegmentReader reader)
@@ -124,7 +127,7 @@
                 return _orderArray.Get(docId) == _index;
             }

-            public override DocIdSetIterator Iterator()
+            public override DocIdSetIterator GetIterator()
             {
                 return new FacetDocIdSetIterator(_dataCache, _index);
             }


Removed commented (invalid) StandardAnalyzer implementation from the Stub StandardAnalyzer class.

--- src/BoboBrowse.Net/BoboBrowse.Net/Support/Stub/StandardAnalyzer.cs
+++ src/BoboBrowse.Net/BoboBrowse.Net/Support/Stub/StandardAnalyzer.cs
@@ -49,200 +49,4 @@
             return new TokenStreamComponents(new LowerCaseTokenizer(matchVersion, reader));
         }
     }
-}
-
-
-
-
-
-/////*
-//// * Licensed to the Apache Software Foundation (ASF) under one or more
-//// * contributor license agreements.  See the NOTICE file distributed with
-//// * this work for additional information regarding copyright ownership.
-//// * The ASF licenses this file to You under the Apache License, Version 2.0
-//// * (the "License"); you may not use this file except in compliance with
-//// * the License.  You may obtain a copy of the License at
-//// *
-//// * http://www.apache.org/licenses/LICENSE-2.0
-//// *
-//// * Unless required by applicable law or agreed to in writing, software
-//// * distributed under the License is distributed on an "AS IS" BASIS,
-//// * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-//// * See the License for the specific language governing permissions and
-//// * limitations under the License.
-//// */
-
-///*
-// * Licensed to the Apache Software Foundation (ASF) under one or more
-// * contributor license agreements.  See the NOTICE file distributed with
-// * this work for additional information regarding copyright ownership.
-// * The ASF licenses this file to You under the Apache License, Version 2.0
-// * (the "License"); you may not use this file except in compliance with
-// * the License.  You may obtain a copy of the License at
-// *
-// * http://www.apache.org/licenses/LICENSE-2.0
-// *
-// * Unless required by applicable law or agreed to in writing, software
-// * distributed under the License is distributed on an "AS IS" BASIS,
-// * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// * See the License for the specific language governing permissions and
-// * limitations under the License.
-// */
-
-//using System;
-//using System.Collections;
-//using System.Collections.Generic;
-//using Lucene.Net.Analysis;
-//using Lucene.Net.Util;
-//using Version = Lucene.Net.Util.Version;
-
-//namespace Lucene.Net.Analysis.Standard
-//{
-
-//    ///  Filters <see cref="StandardTokenizer" /> with <see cref="StandardFilter" />,
-//    /// <see cref="LowerCaseFilter" /> and <see cref="StopFilter" />, using a list of English stop
-//    /// words.
-//    ///
-//    ///
-//    ///

-//    /// You must specify the required <see cref="Version" /> compatibility when creating
-//    /// StandardAnalyzer:
-//    /// <list type="bullet">
-//    /// <item>As of 2.9, StopFilter preserves position increments</item>
-//    /// <item>As of 2.4, Tokens incorrectly identified as acronyms are corrected (see
-//    /// LUCENE-1608)</item>
-//    /// </list>
-//    ///
-//    public class StandardAnalyzer : Analyzer
-//    {
-//        private ISet<string> stopSet;
-
-//        ///  Specifies whether deprecated acronyms should be replaced with HOST type.
-//        /// See https://issues.apache.org/jira/browse/LUCENE-1068
-//        ///
-//        private bool replaceInvalidAcronym, enableStopPositionIncrements;
-
-//        /// An unmodifiable set containing some common English words that are usually not
-//        /// useful for searching.
-//        ///
-//        public static readonly ISet<string> STOP_WORDS_SET;
-//        private Version matchVersion;
-
-//        /// Builds an analyzer with the default stop words (<see cref="STOP_WORDS_SET" />).
-//        ///
-//        /// <param name="matchVersion">Lucene version to match see <see cref="Version">above</see></param>
-//        public StandardAnalyzer(Version matchVersion)
-//            : this(matchVersion, STOP_WORDS_SET)
-//        { }
-
-//        /// Builds an analyzer with the given stop words.
-//        /// <param name="matchVersion">Lucene version to match See <see cref="Version">above</see> />
-//        ///
-//        /// </param>
-//        /// <param name="stopWords">stop words
-//        /// </param>
-//        public StandardAnalyzer(Version matchVersion, ISet<string> stopWords)
-//        {
-//            stopSet = stopWords;
-//            SetOverridesTokenStreamMethod<StandardAnalyzer>();
-//            enableStopPositionIncrements = StopFilter.GetEnablePositionIncrementsVersionDefault(matchVersion);
-//            replaceInvalidAcronym = matchVersion.OnOrAfter(Version.LUCENE_24);
-//            this.matchVersion = matchVersion;
-//        }
-
-//        /// Builds an analyzer with the stop words from the given file.
-//        /// <seealso cref="WordlistLoader.GetWordSet(System.IO.FileInfo)">
-//        /// </seealso>
-//        /// <param name="matchVersion">Lucene version to match See <see cref="Version">above</see> />
-//        ///
-//        /// </param>
-//        /// <param name="stopwords">File to read stop words from
-//        /// </param>
-//        public StandardAnalyzer(Version matchVersion, System.IO.FileInfo stopwords)
-//            : this(matchVersion, WordlistLoader.GetWordSet(stopwords))
-//        {
-//        }
-
-//        /// Builds an analyzer with the stop words from the given reader.
-//        /// <seealso cref="WordlistLoader.GetWordSet(System.IO.TextReader)">
-//        /// </seealso>
-//        /// <param name="matchVersion">Lucene version to match See <see cref="Version">above</see> />
-//        ///
-//        /// </param>
-//        /// <param name="stopwords">Reader to read stop words from
-//        /// </param>
-//        public StandardAnalyzer(Version matchVersion, System.IO.TextReader stopwords)
-//            : this(matchVersion, WordlistLoader.GetWordSet(stopwords))
-//        { }
-
-//        /// Constructs a <see cref="StandardTokenizer" /> filtered by a <see cref="StandardFilter" />
-//        ///, a <see cref="LowerCaseFilter" /> and a <see cref="StopFilter" />.
-//        ///
-//        public override TokenStream TokenStream(System.String fieldName, System.IO.TextReader reader)
-//        {
-//            StandardTokenizer tokenStream = new StandardTokenizer(matchVersion, reader);
-//            tokenStream.MaxTokenLength = maxTokenLength;
-//            TokenStream result = new StandardFilter(tokenStream);
-//            result = new LowerCaseFilter(result);
-//            result = new StopFilter(enableStopPositionIncrements, result, stopSet);
-//            return result;
-//        }
-
-//        private sealed class SavedStreams
-//        {
-//            internal StandardTokenizer tokenStream;
-//            internal TokenStream filteredTokenStream;
-//        }
-
-//        /// Default maximum allowed token length
-//        public const int DEFAULT_MAX_TOKEN_LENGTH = 255;
-
-//        private int maxTokenLength = DEFAULT_MAX_TOKEN_LENGTH;
-
-//        ///  Set maximum allowed token length.  If a token is seen
-//        /// that exceeds this length then it is discarded.  This
-//        /// setting only takes effect the next time tokenStream or
-//        /// reusableTokenStream is called.
-//        ///
-//        public virtual int MaxTokenLength
-//        {
-//            get { return maxTokenLength; }
-//            set { maxTokenLength = value; }
-//        }
-
-//        public override TokenStream ReusableTokenStream(System.String fieldName, System.IO.TextReader reader)
-//        {
-//            if (overridesTokenStreamMethod)
-//            {
-//                // LUCENE-1678: force fallback to tokenStream() if we
-//                // have been subclassed and that subclass overrides
-//                // tokenStream but not reusableTokenStream
-//                return TokenStream(fieldName, reader);
-//            }
-//            SavedStreams streams = (SavedStreams)PreviousTokenStream;
-//            if (streams == null)
-//            {
-//                streams = new SavedStreams();
-//                PreviousTokenStream = streams;
-//                streams.tokenStream = new StandardTokenizer(matchVersion, reader);
-//                streams.filteredTokenStream = new StandardFilter(streams.tokenStream);
-//                streams.filteredTokenStream = new LowerCaseFilter(streams.filteredTokenStream);
-//                streams.filteredTokenStream = new StopFilter(enableStopPositionIncrements,
-//                                                             streams.filteredTokenStream, stopSet);
-//            }
-//            else
-//            {
-//                streams.tokenStream.Reset(reader);
-//            }
-//            streams.tokenStream.MaxTokenLength = maxTokenLength;
-
-//            streams.tokenStream.SetReplaceInvalidAcronym(replaceInvalidAcronym);
-
-//            return streams.filteredTokenStream;
-//        }
-//        static StandardAnalyzer()
-//        {
-//            STOP_WORDS_SET = StopAnalyzer.ENGLISH_STOP_WORDS_SET;
-//        }
-//    }
-//}
+}


Bridge - Workaround - Math sign ambiguity

--- Granular.Presentation/Controls/ScrollViewer.cs
+++ Granular.Presentation/Controls/ScrollViewer.cs
@@ -228,7 +228,7 @@
         {
             if (scrollContentPresenter != null)
             {
-                VerticalOffset = (VerticalOffset - Math.Sign(e.Delta) * ScrollInfoExtensions.MouseWheelDelta).Bounds(0, ScrollableHeight);
+                VerticalOffset = (VerticalOffset - Math.Sign((double)e.Delta) * ScrollInfoExtensions.MouseWheelDelta).Bounds(0, ScrollableHeight);
                 e.Handled = true;
             }
         }


Add long wait for calc.

Add long wait for calc.

--- Gu.Wpf.UiAutomation.UiTests/CalculatorTests.cs
+++ Gu.Wpf.UiAutomation.UiTests/CalculatorTests.cs
@@ -37,6 +37,8 @@
         {
             using (var app = StartApplication())
             {
+                // Looks like it can take a long time on CI
+                app.WaitForMainWindow(TimeSpan.FromSeconds(30));
                 var window = app.MainWindow;
                 var calc = WindowsVersion.IsWindows10()
                     ? (ICalculator)new Win10Calc(window)
@@ -44,11 +46,7 @@
                 Wait.For(TimeSpan.FromMilliseconds(200));

                 // Switch to default mode
-                using (Keyboard.Hold(Key.ALT))
-                {
-                    Keyboard.Hold(Key.KEY_1).Dispose();
-                }
-
+                Keyboard.TypeSimultaneously(Key.ALT, Key.KEY_1);
                 window.WaitUntilResponsive();

                 // Simple addition


Closes #24; Add catch all to the application

--- HotChocolatey/ViewModel/MainWindowViewModel.cs
+++ HotChocolatey/ViewModel/MainWindowViewModel.cs
@@ -50,6 +50,10 @@
             Log.ResetSettings(true, true, true, Diagnostics);
             Log.Info("---");
             Log.Info($"Version:{Assembly.GetCallingAssembly().GetName().Version} MachineName:{Environment.MachineName} OSVersion:{Environment.OSVersion} Is64BitOperatingSystem:{Environment.Is64BitOperatingSystem}");
+
+#if !DEBUG
+            Application.Current.DispatcherUnhandledException += (s, e) => Log.Error("DispatcherUnhandledException: {0}", e.Exception);
+#endif

             RefreshCommand = new AwaitableDelegateCommand(ExecuteRefreshCommand);
             UpgradeAllCommand = new AwaitableDelegateCommand(ExecuteUpgradeAllCommand);


missing space in log target

missing space in log target

--- IPTables.Net/Iptables/Modules/Log/LogModule.cs
+++ IPTables.Net/Iptables/Modules/Log/LogModule.cs
@@ -48,6 +48,7 @@
                 sb.Append(Helpers.EscapeArguments(LogPrefix));
             }

+            if (sb.Length != 0) sb.Append(" ");
             sb.Append(OptionLevelLong + " ");
             sb.Append(LogLevel);


Add ByteArrayCodeReader tests

Add ByteArrayCodeReader tests

--- Iced.UnitTests/Intel/DecoderTests/MiscTests.cs
+++ Iced.UnitTests/Intel/DecoderTests/MiscTests.cs
@@ -2970,5 +2970,107 @@
 			decoder.Decode(out var instr);
 			Assert.Equal(code, instr.Code);
 		}
+
+		[Theory]
+		[MemberData(nameof(Test_ByteArrayCodeReader_ctor_Data))]
+		void Test_ByteArrayCodeReader_ctor(ByteArrayCodeReader reader, byte[] expectedData) {
+			int i = 0;
+			Assert.Equal(0, reader.Position);
+			while (reader.CanReadByte) {
+				Assert.Equal(i, reader.Position);
+				Assert.True(i < expectedData.Length);
+				Assert.Equal(expectedData[i], reader.ReadByte());
+				i++;
+			}
+			Assert.Equal(i, reader.Position);
+			Assert.Equal(expectedData.Length, i);
+			Assert.Equal(-1, reader.ReadByte());
+			Assert.Equal(i, reader.Position);
+
+			reader.Position = 0;
+			Assert.Equal(0, reader.Position);
+			i = 0;
+			while (reader.CanReadByte) {
+				Assert.Equal(i, reader.Position);
+				Assert.True(i < expectedData.Length);
+				Assert.Equal(expectedData[i], reader.ReadByte());
+				i++;
+			}
+			Assert.Equal(i, reader.Position);
+			Assert.Equal(expectedData.Length, i);
+			Assert.Equal(-1, reader.ReadByte());
+			Assert.Equal(i, reader.Position);
+
+			reader.Position = reader.Count;
+			Assert.Equal(reader.Count, reader.Position);
+			Assert.False(reader.CanReadByte);
+			Assert.Equal(-1, reader.ReadByte());
+
+			for (i = expectedData.Length - 1; i >= 0; i--) {
+				reader.Position = i;
+				Assert.Equal(i, reader.Position);
+				Assert.True(reader.CanReadByte);
+				Assert.Equal(expectedData[i], reader.ReadByte());
+				Assert.Equal(i + 1, reader.Position);
+			}
+		}
+		public static IEnumerable<object[]> Test_ByteArrayCodeReader_ctor_Data {
+			get {
+				yield return new object[] { new ByteArrayCodeReader(""), new byte[] { } };
+				yield return new object[] { new ByteArrayCodeReader("12"), new byte[] { 0x12 } };
+				yield return new object[] { new ByteArrayCodeReader("1234"), new byte[] { 0x12, 0x34 } };
+
+				yield return new object[] { new ByteArrayCodeReader(new byte[] { }), new byte[] { } };
+				yield return new object[] { new ByteArrayCodeReader(new byte[] { 0x23 }), new byte[] { 0x23 } };
+				yield return new object[] { new ByteArrayCodeReader(new byte[] { 0x23, 0x45 }), new byte[] { 0x23, 0x45 } };
+
+				yield return new object[] { new ByteArrayCodeReader(new byte[] { }, 0, 0), new byte[] { } };
+				yield return new object[] { new ByteArrayCodeReader(new byte[] { 0x45 }, 0, 1), new byte[] { 0x45 } };
+				yield return new object[] { new ByteArrayCodeReader(new byte[] { 0x45, 0x67 }, 0, 2), new byte[] { 0x45, 0x67 } };
+				yield return new object[] { new ByteArrayCodeReader(new byte[] { 0x45, 0x67, 0x89 }, 0, 3), new byte[] { 0x45, 0x67, 0x89 } };
+				yield return new object[] { new ByteArrayCodeReader(new byte[] { 0x45, 0x67, 0x89, 0xAB }, 0, 4), new byte[] { 0x45, 0x67, 0x89, 0xAB } };
+				yield return new object[] { new ByteArrayCodeReader(new byte[] { 0x45, 0x67, 0x89, 0xAB }, 1, 3), new byte[] { 0x67, 0x89, 0xAB } };
+				yield return new object[] { new ByteArrayCodeReader(new byte[] { 0x45, 0x67, 0x89, 0xAB }, 2, 2), new byte[] { 0x89, 0xAB } };
+				yield return new object[] { new ByteArrayCodeReader(new byte[] { 0x45, 0x67, 0x89, 0xAB }, 3, 1), new byte[] { 0xAB } };
+				yield return new object[] { new ByteArrayCodeReader(new byte[] { 0x45, 0x67, 0x89, 0xAB }, 4, 0), new byte[] { } };
+				yield return new object[] { new ByteArrayCodeReader(new byte[] { 0x45, 0x67, 0x89, 0xAB }, 0, 3), new byte[] { 0x45, 0x67, 0x89 } };
+				yield return new object[] { new ByteArrayCodeReader(new byte[] { 0x45, 0x67, 0x89, 0xAB }, 0, 2), new byte[] { 0x45, 0x67 } };
+				yield return new object[] { new ByteArrayCodeReader(new byte[] { 0x45, 0x67, 0x89, 0xAB }, 0, 1), new byte[] { 0x45 } };
+				yield return new object[] { new ByteArrayCodeReader(new byte[] { 0x45, 0x67, 0x89, 0xAB }, 0, 0), new byte[] { } };
+				yield return new object[] { new ByteArrayCodeReader(new byte[] { 0x45, 0x67, 0x89, 0xAB }, 1, 2), new byte[] { 0x67, 0x89 } };
+				yield return new object[] { new ByteArrayCodeReader(new byte[] { 0x45, 0x67, 0x89, 0xAB }, 1, 1), new byte[] { 0x67 } };
+				yield return new object[] { new ByteArrayCodeReader(new byte[] { 0x45, 0x67, 0x89, 0xAB }, 2, 1), new byte[] { 0x89 } };
+
+				yield return new object[] { new ByteArrayCodeReader(new ArraySegment<byte>(new byte[] { }, 0, 0)), new byte[] { } };
+				yield return new object[] { new ByteArrayCodeReader(new ArraySegment<byte>(new byte[] { 0x45 }, 0, 1)), new byte[] { 0x45 } };
+				yield return new object[] { new ByteArrayCodeReader(new ArraySegment<byte>(new byte[] { 0x45, 0x67 }, 0, 2)), new byte[] { 0x45, 0x67 } };
+				yield return new object[] { new ByteArrayCodeReader(new ArraySegment<byte>(new byte[] { 0x45, 0x67, 0x89 }, 0, 3)), new byte[] { 0x45, 0x67, 0x89 } };
+				yield return new object[] { new ByteArrayCodeReader(new ArraySegment<byte>(new byte[] { 0x45, 0x67, 0x89, 0xAB }, 0, 4)), new byte[] { 0x45, 0x67, 0x89, 0xAB } };
+				yield return new object[] { new ByteArrayCodeReader(new ArraySegment<byte>(new byte[] { 0x45, 0x67, 0x89, 0xAB }, 1, 3)), new byte[] { 0x67, 0x89, 0xAB } };
+				yield return new object[] { new ByteArrayCodeReader(new ArraySegment<byte>(new byte[] { 0x45, 0x67, 0x89, 0xAB }, 2, 2)), new byte[] { 0x89, 0xAB } };
+				yield return new object[] { new ByteArrayCodeReader(new ArraySegment<byte>(new byte[] { 0x45, 0x67, 0x89, 0xAB }, 3, 1)), new byte[] { 0xAB } };
+				yield return new object[] { new ByteArrayCodeReader(new ArraySegment<byte>(new byte[] { 0x45, 0x67, 0x89, 0xAB }, 4, 0)), new byte[] { } };
+				yield return new object[] { new ByteArrayCodeReader(new ArraySegment<byte>(new byte[] { 0x45, 0x67, 0x89, 0xAB }, 0, 3)), new byte[] { 0x45, 0x67, 0x89 } };
+				yield return new object[] { new ByteArrayCodeReader(new ArraySegment<byte>(new byte[] { 0x45, 0x67, 0x89, 0xAB }, 0, 2)), new byte[] { 0x45, 0x67 } };
+				yield return new object[] { new ByteArrayCodeReader(new ArraySegment<byte>(new byte[] { 0x45, 0x67, 0x89, 0xAB }, 0, 1)), new byte[] { 0x45 } };
+				yield return new object[] { new ByteArrayCodeReader(new ArraySegment<byte>(new byte[] { 0x45, 0x67, 0x89, 0xAB }, 0, 0)), new byte[] { } };
+				yield return new object[] { new ByteArrayCodeReader(new ArraySegment<byte>(new byte[] { 0x45, 0x67, 0x89, 0xAB }, 1, 2)), new byte[] { 0x67, 0x89 } };
+				yield return new object[] { new ByteArrayCodeReader(new ArraySegment<byte>(new byte[] { 0x45, 0x67, 0x89, 0xAB }, 1, 1)), new byte[] { 0x67 } };
+				yield return new object[] { new ByteArrayCodeReader(new ArraySegment<byte>(new byte[] { 0x45, 0x67, 0x89, 0xAB }, 2, 1)), new byte[] { 0x89 } };
+			}
+		}
+
+		[Fact]
+		void Test_ByteArrayCodeReader_throws() {
+			Assert.Throws<ArgumentNullException>(() => new ByteArrayCodeReader((string)null));
+			Assert.Throws<ArgumentNullException>(() => new ByteArrayCodeReader((byte[])null));
+			Assert.Throws<ArgumentNullException>(() => new ByteArrayCodeReader((byte[])null, 0, 0));
+			Assert.Throws<ArgumentException>(() => new ByteArrayCodeReader(default(ArraySegment<byte>)));
+			Assert.Throws<ArgumentOutOfRangeException>(() => new ByteArrayCodeReader(new byte[] { 1, 2, 3, 4 }, -1, 0));
+			Assert.Throws<ArgumentOutOfRangeException>(() => new ByteArrayCodeReader(new byte[] { 1, 2, 3, 4 }, int.MinValue, 0));
+			Assert.Throws<ArgumentOutOfRangeException>(() => new ByteArrayCodeReader(new byte[] { 1, 2, 3, 4 }, 0, 5));
+			Assert.Throws<ArgumentOutOfRangeException>(() => new ByteArrayCodeReader(new byte[] { 1, 2, 3, 4 }, 0, int.MaxValue));
+			Assert.Throws<ArgumentOutOfRangeException>(() => new ByteArrayCodeReader(new byte[] { 1, 2, 3, 4 }, int.MinValue, int.MaxValue));
+		}
 	}
 }


Fixed bug in IdentifierTerminal; now correctly identifies Keyword tokens

--- Irony/Compiler/Terminals/IdentifierTerminal.cs
+++ Irony/Compiler/Terminals/IdentifierTerminal.cs
@@ -106,6 +106,10 @@
       if (FlagIsSet(details, IdFlags.IsNotKeyword))
         return token;
       //check if it is keyword
+      CheckKeyword(token);
+      return token;
+    }
+    private void CheckKeyword(Token token) {
       string text = token.Text;
       if (!Grammar.CaseSensitive)
         text = text.ToLower();
@@ -113,7 +117,6 @@
         token.IsKeyword = true;
         token.EditorInfo = KeywordEditorInfo; //overwrite identifier editor info copied by default by token constructor
       }
-      return token;
     }

     protected override Token QuickParse(CompilerContext context, ISourceStream source) {
@@ -125,7 +128,9 @@
       //if it is not a terminator then cancel; we need to go through full algorithm
       if (_terminators.IndexOf(source.CurrentChar) < 0) return null;
       string text = source.GetLexeme();
-      return Token.Create(this, context, source.TokenStart, text);
+      Token token = Token.Create(this, context, source.TokenStart, text);
+      CheckKeyword(token);
+      return token;
     }

     protected override bool ReadBody(ISourceStream source, CompoundTokenDetails details) {


Fix double-sync (Issue 1231)

Fix double-sync (Issue 1231)

 - calling `base.SaveChangesAsync` internally calls `SaveChangesAsync(CancellationToken.None)` so we ended up calling `base.SaveChangesAsync` and `SyncObjectsStatePostCommit` twice.
 - instead make the subclass call it's own SaveChangesAsync(CancellationToken.None) without a surrounding change sync

Ref: https://genericunitofworkandrepositories.codeplex.com/workitem/1231

--- main/Source/Repository.Pattern.Ef6/DataContext.cs
+++ main/Source/Repository.Pattern.Ef6/DataContext.cs
@@ -77,10 +77,7 @@
         ///     objects written to the underlying database.</returns>
         public override async Task<int> SaveChangesAsync()
         {
-            SyncObjectsStatePreCommit();
-            var changesAsync = await base.SaveChangesAsync();
-            SyncObjectsStatePostCommit();
-            return changesAsync;
+            return await this.SaveChangesAsync(CancellationToken.None);
         }
         /// <summary>
         ///     Asynchronously saves all changes made in this context to the underlying database.


linux console runs

linux console runs

--- Pickaxe/PlatConsole/UnixConsole.cs
+++ Pickaxe/PlatConsole/UnixConsole.cs
@@ -46,11 +46,14 @@

         public void PrintError(string value)
         {
+            Console.Write("\u001b[0;31m"); //red
             Print(value);
+            Console.Write("\u001b[0m"); //reset
         }

         public void Print(string value)
         {
+            MoveCursor(CurrentLine);
             Console.WriteLine(value);
             CurrentLine++;
         }


2303.1

--- src/Tests/TestWinForm_MiniAgg_GLES/3_Samples/05_AlphaMask2/FontTextureDemo2.cs
+++ src/Tests/TestWinForm_MiniAgg_GLES/3_Samples/05_AlphaMask2/FontTextureDemo2.cs
@@ -69,11 +69,10 @@
         public void DrawString(Painter p, char[] buffer, int startAt, int len, double x, double y)
         {

-            AggPainter painter = p as AggPainter;
-
-
-
-            if (painter == null) return;
+
+
+
+            if (!(p is AggPainter painter)) return;
             //

             int width = painter.Width;
@@ -118,8 +117,7 @@
             for (int i = 0; i < seqLen; ++i)
             {
                 UnscaledGlyphPlan glyph = glyphPlanSeq[i];
-                TextureGlyphMapData glyphData;
-                if (!_fontAtlas.TryGetGlyphMapData(glyph.glyphIndex, out glyphData))
+                if (!_fontAtlas.TryGetGlyphMapData(glyph.glyphIndex, out TextureGlyphMapData glyphData))
                 {
                     //if no glyph data, we should render a missing glyph ***
                     continue;
@@ -146,7 +144,8 @@
                 //_maskBufferPainter.Clear(Color.Black);
                 _maskBufferPainter.FillRect(gx - 1, gy - 1, srcW + 2, srcH + 2, Color.Black);
                 //draw 'stencil' glyph on mask-buffer
-                _maskBufferPainter.DrawImage(_fontBmp, gx, gy, srcX, _fontBmp.Height - (srcY), srcW, srcH);
+                //_maskBufferPainter.DrawImage(_fontBmp, gx, gy, srcX, _fontBmp.Height - (srcY), srcW, srcH);
+                _maskBufferPainter.DrawImage(_fontBmp, gx, gy, srcX, srcY, srcW, srcH);

                 //select component to render this need to render 3 times for lcd technique
                 //1. B


fixed console writer up to date project filter

--- src/Handyman.Tools.Outdated/src/Analyze/ResultConsoleWriter.cs
+++ src/Handyman.Tools.Outdated/src/Analyze/ResultConsoleWriter.cs
@@ -129,7 +129,7 @@

         private void WriteUpToDate(IReadOnlyCollection<Project> projects)
         {
-            projects = projects.Where(x => !x.Errors.Any() || !x.TargetFrameworks.Any()).ToList();
+            projects = projects.Where(x => !x.Errors.Any() && !x.TargetFrameworks.Any()).ToList();

             if (!projects.Any())
                 return;


Fixing up test for QueryLocator to demonstrate that QueryLocator will throw an argument exception if a query does not implement IQueryResult.

--- src/NewRelic.Microsoft.SqlServer.Plugin.Tests/QueryLocatorTests.cs
+++ src/NewRelic.Microsoft.SqlServer.Plugin.Tests/QueryLocatorTests.cs
@@ -1,5 +1,4 @@
 using System;
-using System.Collections.Generic;
 using System.Linq;
 using System.Reflection;
 using NSubstitute;
@@ -11,136 +10,150 @@

 namespace NewRelic.Microsoft.SqlServer.Plugin
 {
-	[TestFixture]
-	public class QueryLocatorTests
-	{
-		[SqlMonitorQuery("NewRelic.Microsoft.SqlServer.Plugin.Core.ExampleEmbeddedFile.sql")]
-		private class QueryTypeWithExactResourceName : FakeQueryResultBase {}
+    [TestFixture]
+    public class QueryLocatorTests
+    {
+        [SqlMonitorQuery("NewRelic.Microsoft.SqlServer.Plugin.Core.ExampleEmbeddedFile.sql")]
+        private class QueryTypeWithExactResourceName : FakeQueryResultBase {}

-		[SqlMonitorQuery("Queries.ExampleEmbeddedFile.sql")]
-		private class QueryTypeWithPartialResourceName : FakeQueryResultBase {}
+        [SqlMonitorQuery("Queries.ExampleEmbeddedFile.sql")]
+        private class QueryTypeWithPartialResourceName : FakeQueryResultBase {}

-		[SqlMonitorQuery("AnotherQuery.sql")]
-		private class QueryTypeWithJustFileName : FakeQueryResultBase {}
+        [SqlMonitorQuery("AnotherQuery.sql")]
+        private class QueryTypeWithJustFileName : FakeQueryResultBase {}

-		[SqlMonitorQuery("AnotherQuery.sql")]
-		[SqlMonitorQuery("Queries.ExampleEmbeddedFile.sql")]
-		private class QueryTypeWithTwoQueries : FakeQueryResultBase {}
+        [SqlMonitorQuery("AnotherQuery.sql")]
+        [SqlMonitorQuery("Queries.ExampleEmbeddedFile.sql")]
+        private class QueryTypeWithTwoQueries : FakeQueryResultBase {}

-		[SqlMonitorQuery("Foo.sql", Enabled = false)]
-		private class QueryTypeDisabled : FakeQueryResultBase {}
+        [SqlMonitorQuery("Foo.sql", Enabled = false)]
+        private class QueryTypeDisabled : FakeQueryResultBase {}

-		[SqlMonitorQuery("Foo.sql", Enabled = false)]
-		[SqlMonitorQuery("AnotherQuery.sql", QueryName = "This is enabled")]
-		private class QueryTypeSomeEnabled : FakeQueryResultBase {}
+        [SqlMonitorQuery("Foo.sql", Enabled = false)]
+        [SqlMonitorQuery("AnotherQuery.sql", QueryName = "This is enabled")]
+        private class QueryTypeSomeEnabled : FakeQueryResultBase {}

-		private class FakeQueryResultBase : IQueryResult
-		{
-			public void AddMetrics(ComponentData componentData) {}
-		}
+        [SqlMonitorQuery("AnotherQuery.sql", QueryName = "This is enabled")]
+        private class QueryThatIsNotIQueryResult {}

-		[Test]
-		public void Assert_funcs_are_correctly_configured()
-		{
-			var dapperWrapper = Substitute.For<IDapperWrapper>();
+        private class FakeQueryResultBase : IQueryResult
+        {
+            public void AddMetrics(ComponentData componentData) {}
+        }

-			var queries = new QueryLocator(dapperWrapper).PrepareQueries();
-			foreach (var query in queries)
-			{
-				var results = query.Invoke(null);
-				Assert.That(results, Is.EqualTo(new object[0]));
-			}
-		}

-		[Test]
-		public void Assert_multiple_query_attributes_yield_multiple_queries()
-		{
-			var assembly = Assembly.GetExecutingAssembly();
-			var queryLocator = new QueryLocator(null, assembly);
+        [Test]
+        public void Assert_funcs_are_correctly_configured()
+        {
+            var dapperWrapper = Substitute.For<IDapperWrapper>();

-			var queries = queryLocator.PrepareQueries(new[] {typeof (QueryTypeWithTwoQueries)});
-			Assert.That(queries, Is.Not.Null);
-			var queryNames = queries.Select(q => q.ResourceName).ToArray();
-			var expected = new[] {"AnotherQuery.sql", "Queries.ExampleEmbeddedFile.sql"};
-			Assert.That(queryNames, Is.EquivalentTo(expected));
-		}
+            var queries = new QueryLocator(dapperWrapper).PrepareQueries();
+            foreach (var query in queries)
+            {
+                var results = query.Invoke(null);
+                Assert.That(results, Is.EqualTo(new object[0]));
+            }
+        }

-		[Test]
-		public void Assert_resource_with_exact_resource_name_is_located()
-		{
-			var assembly = Assembly.GetExecutingAssembly();
-			var queryLocator = new QueryLocator(null, assembly);
+        [Test]
+        public void Assert_multiple_query_attributes_yield_multiple_queries()
+        {
+            var assembly = Assembly.GetExecutingAssembly();
+            var queryLocator = new QueryLocator(null, assembly);

-			var queries = queryLocator.PrepareQueries(new[] {typeof (QueryTypeWithExactResourceName)});
-			Assert.That(queries, Is.Not.Null);
-			var queryNames = queries.Select(q => q.ResultTypeName).ToArray();
-			Assert.That(queryNames, Is.EqualTo(new[] {typeof (QueryTypeWithExactResourceName).Name}));
-		}
+            var queries = queryLocator.PrepareQueries(new[] {typeof (QueryTypeWithTwoQueries)});
+            Assert.That(queries, Is.Not.Null);
+            var queryNames = queries.Select(q => q.ResourceName).ToArray();
+            var expected = new[] {"AnotherQuery.sql", "Queries.ExampleEmbeddedFile.sql"};
+            Assert.That(queryNames, Is.EquivalentTo(expected));
+        }

-		[Test]
-		public void Assert_resource_with_only_file_name_is_located()
-		{
-			var assembly = Assembly.GetExecutingAssembly();
-			var queryLocator = new QueryLocator(null, assembly);
+        [Test]
+        [ExpectedException(typeof (ArgumentException))]
+        public void Assert_queries_not_IQueryResult_throws_exception()
+        {
+            var assembly = Assembly.GetExecutingAssembly();
+            var queryLocator = new QueryLocator(null, assembly);

-			var queries = queryLocator.PrepareQueries(new[] {typeof (QueryTypeWithJustFileName)});
-			Assert.That(queries, Is.Not.Null);
-			var queryNames = queries.Select(q => q.ResultTypeName).ToArray();
-			Assert.That(queryNames, Is.EqualTo(new[] {typeof (QueryTypeWithJustFileName).Name}));
-		}
+            queryLocator.PrepareQueries(new[] {typeof (QueryThatIsNotIQueryResult)});
+        }

-		[Test]
-		public void Assert_resource_with_partial_resource_name_is_located()
-		{
-			var assembly = Assembly.GetExecutingAssembly();
-			var queryLocator = new QueryLocator(null, assembly);
+        [Test]
+        public void Assert_resource_with_exact_resource_name_is_located()
+        {
+            var assembly = Assembly.GetExecutingAssembly();
+            var queryLocator = new QueryLocator(null, assembly);

-			var queries = queryLocator.PrepareQueries(new[] {typeof (QueryTypeWithPartialResourceName)});
-			Assert.That(queries, Is.Not.Null);
-			var queryNames = queries.Select(q => q.ResultTypeName).ToArray();
-			Assert.That(queryNames, Is.EqualTo(new[] {typeof (QueryTypeWithPartialResourceName).Name}));
-		}
+            var queries = queryLocator.PrepareQueries(new[] {typeof (QueryTypeWithExactResourceName)});
+            Assert.That(queries, Is.Not.Null);
+            var queryNames = queries.Select(q => q.ResultTypeName).ToArray();
+            Assert.That(queryNames, Is.EqualTo(new[] {typeof (QueryTypeWithExactResourceName).Name}));
+        }

-		[Test]
-		public void Assert_some_query_types_are_found()
-		{
-			var assembly = Assembly.GetExecutingAssembly();
+        [Test]
+        public void Assert_resource_with_only_file_name_is_located()
+        {
+            var assembly = Assembly.GetExecutingAssembly();
+            var queryLocator = new QueryLocator(null, assembly);

-			var types = assembly.GetTypes();
-			Assume.That(types, Is.Not.Empty, "Expected at least one type in the test assembly");
+            var queries = queryLocator.PrepareQueries(new[] {typeof (QueryTypeWithJustFileName)});
+            Assert.That(queries, Is.Not.Null);
+            var queryNames = queries.Select(q => q.ResultTypeName).ToArray();
+            Assert.That(queryNames, Is.EqualTo(new[] {typeof (QueryTypeWithJustFileName).Name}));
+        }

-			var typesWithAttribute = types.Where(t => t.GetCustomAttributes<SqlMonitorQueryAttribute>().Any());
-			Assert.That(typesWithAttribute, Is.Not.Empty, "Expected at least one QueryType using the " + typeof (SqlMonitorQueryAttribute).Name);
-		}
+        [Test]
+        public void Assert_resource_with_partial_resource_name_is_located()
+        {
+            var assembly = Assembly.GetExecutingAssembly();
+            var queryLocator = new QueryLocator(null, assembly);

-		[Test]
-		public void Assert_that_disabled_queries_are_ignored()
-		{
-			var assembly = Assembly.GetExecutingAssembly();
-			var queryLocator = new QueryLocator(null, assembly);
+            var queries = queryLocator.PrepareQueries(new[] {typeof (QueryTypeWithPartialResourceName)});
+            Assert.That(queries, Is.Not.Null);
+            var queryNames = queries.Select(q => q.ResultTypeName).ToArray();
+            Assert.That(queryNames, Is.EqualTo(new[] {typeof (QueryTypeWithPartialResourceName).Name}));
+        }

-			var queries = queryLocator.PrepareQueries(new[] {typeof (QueryTypeDisabled)});
-			Assert.That(queries, Is.Empty);
-		}
+        [Test]
+        public void Assert_some_query_types_are_found()
+        {
+            var assembly = Assembly.GetExecutingAssembly();

-		[Test]
-		public void Assert_that_only_enabled_queries_are_found()
-		{
-			var assembly = Assembly.GetExecutingAssembly();
-			var queryLocator = new QueryLocator(null, assembly);
+            var types = assembly.GetTypes();
+            Assume.That(types, Is.Not.Empty, "Expected at least one type in the test assembly");

-			var queries = queryLocator.PrepareQueries(new[] {typeof (QueryTypeSomeEnabled)})
-			                          .Select(q => q.QueryName)
-			                          .ToArray();
+            var typesWithAttribute = types.Where(t => t.GetCustomAttributes<SqlMonitorQueryAttribute>().Any());
+            Assert.That(typesWithAttribute, Is.Not.Empty, "Expected at least one QueryType using the " + typeof (SqlMonitorQueryAttribute).Name);
+        }

-			Assert.That(queries, Is.EqualTo(new[] {"This is enabled"}));
-		}
+        [Test]
+        public void Assert_that_disabled_queries_are_ignored()
+        {
+            var assembly = Assembly.GetExecutingAssembly();
+            var queryLocator = new QueryLocator(null, assembly);

-		[Test]
-		public void Assert_that_queries_are_located()
-		{
-			var queries = new QueryLocator(new DapperWrapper(), Assembly.GetExecutingAssembly()).PrepareQueries();
-			Assert.That(queries, Is.Not.Empty, "Expected some queries to be returned");
-		}
-	}
-}
+            var queries = queryLocator.PrepareQueries(new[] {typeof (QueryTypeDisabled)});
+            Assert.That(queries, Is.Empty);
+        }
+
+        [Test]
+        public void Assert_that_only_enabled_queries_are_found()
+        {
+            var assembly = Assembly.GetExecutingAssembly();
+            var queryLocator = new QueryLocator(null, assembly);
+
+            var queries = queryLocator.PrepareQueries(new[] {typeof (QueryTypeSomeEnabled)})
+                                      .Select(q => q.QueryName)
+                                      .ToArray();
+
+            Assert.That(queries, Is.EqualTo(new[] {"This is enabled"}));
+        }
+
+        [Test]
+        public void Assert_that_queries_are_located()
+        {
+            var queries = new QueryLocator(new DapperWrapper(), Assembly.GetExecutingAssembly(), new[] {typeof (QueryThatIsNotIQueryResult)}).PrepareQueries();
+            Assert.That(queries, Is.Not.Empty, "Expected some queries to be returned");
+        }
+    }
+}


add AccountLegalEntityPublicHashedId to Apprenticeship

--- src/SFA.DAS.Commitments.Api.Types/Apprenticeship/Apprenticeship.cs
+++ src/SFA.DAS.Commitments.Api.Types/Apprenticeship/Apprenticeship.cs
@@ -34,6 +34,7 @@
         public string ProviderName { get; set; }
         public string LegalEntityId { get; set; }
         public string LegalEntityName { get; set; }
+        public string AccountLegalEntityPublicHashedId { get; set; }

         public bool DataLockPrice { get; set; }
         public bool DataLockPriceTriaged { get; set; }


Implemented Java method signature generation.

--- binder/Generators/Java/JavaSources.cs
+++ binder/Generators/Java/JavaSources.cs
@@ -3,6 +3,7 @@
 using System.Linq;
 using CppSharp;
 using CppSharp.AST;
+using CppSharp.AST.Extensions;
 using CppSharp.Generators;
 using CppSharp.Generators.CSharp;

@@ -123,7 +124,7 @@
         {
             var keywords = new List<string>();

-            keywords.Add(@class.Access == AccessSpecifier.Protected ? "protected internal" : "public");
+            keywords.Add(AccessIdentifier(@class.Access));

             if (@class.IsAbstract)
                 keywords.Add("abstract");
@@ -167,8 +168,50 @@
             return true;
         }

+        public override void GenerateMethodSpecifier(Method method, Class @class)
+        {
+            var keywords = new List<string>();
+
+            if (method.IsGeneratedOverride())
+            {
+                Write("@Override");
+                NewLine();
+            }
+
+            if (method.IsStatic)
+                keywords.Add("static");
+
+            if (method.IsPure)
+                keywords.Add("abstract");
+
+            if (keywords.Count != 0)
+                Write("{0} ", string.Join(" ", keywords));
+
+            var functionName = GetMethodIdentifier(method);
+
+            if (method.IsConstructor || method.IsDestructor)
+                Write("{0}(", functionName);
+            else
+                Write("{0} {1}(", method.OriginalReturnType, functionName);
+
+            //Write(FormatMethodParameters(method.Parameters));
+
+            Write(")");
+        }
+
         public override bool VisitMethodDecl(Method method)
         {
+            PushBlock(BlockKind.Method, method);
+
+            var @class = method.Namespace as Class;
+            GenerateMethodSpecifier(method, @class);
+            NewLine();
+
+            WriteStartBraceIndent();
+            WriteCloseBraceIndent();
+
+            PopBlock(NewLineKind.BeforeNextBlock);
+
             return true;
         }


Optimise Spring to compute norm only once

--- Boing/Forces/Spring.cs
+++ Boing/Forces/Spring.cs
@@ -54,8 +54,8 @@
             var target = Target;

             var delta = target.Position - source.Position;
-            var displacement = Length - delta.Norm();
-            var direction = delta.Normalized();
+            var direction = delta.Normalized(out float deltaNorm);
+            var displacement = Length - deltaNorm;

             Debug.Assert(!float.IsNaN(displacement), "!float.IsNaN(displacement)");


Disable tests on Linux

Disable tests on Linux

--- src/System.Net.Http/tests/FunctionalTests/HttpClientHandlerTest.cs
+++ src/System.Net.Http/tests/FunctionalTests/HttpClientHandlerTest.cs
@@ -638,6 +638,7 @@

         #region Various HTTP Method Tests

+        [ActiveIssue(4187, PlatformID.AnyUnix)]
         [Theory, MemberData("HttpMethods")]
         public async Task SendAsync_SendRequestUsingMethodToEchoServerWithNoContent_MethodCorrectlySent(
             string method,
@@ -656,6 +657,7 @@
             }
         }

+        [ActiveIssue(4187, PlatformID.AnyUnix)]
         [Theory, MemberData("HttpMethodsThatAllowContent")]
         public async Task SendAsync_SendRequestUsingMethodToEchoServerWithContent_Success(
             string method,


use TestHelper.AllowAllCertificates for validation callback to pass test netfx

--- src/System.Net.Http/tests/FunctionalTests/HttpClientHandlerTest.cs
+++ src/System.Net.Http/tests/FunctionalTests/HttpClientHandlerTest.cs
@@ -2793,7 +2793,7 @@
             {
                 // Point handler at out loopback proxy
                 handler.Proxy = new UseSpecifiedUriWebProxy(proxyUrl, null);
-                handler.ServerCertificateCustomValidationCallback = HttpClientHandler.DangerousAcceptAnyServerCertificateValidator;
+                handler.ServerCertificateCustomValidationCallback = TestHelper.AllowAllCertificates;

                 using (HttpClient client = new HttpClient(handler))
                 {


Fix crash if reloading plugins reports errors before the main window appears

--- Browser/FormBrowser.cs
+++ Browser/FormBrowser.cs
@@ -263,9 +263,7 @@

         private void plugins_Reloaded(object sender, PluginErrorEventArgs e){
             if (e.HasErrors){
-                this.InvokeAsyncSafe(() => { // TODO not needed but makes code consistent...
-                    FormMessage.Error("Error Loading Plugins", "The following plugins will not be available until the issues are resolved:\n\n" + string.Join("\n\n", e.Errors), FormMessage.OK);
-                });
+                FormMessage.Error("Error Loading Plugins", "The following plugins will not be available until the issues are resolved:\n\n" + string.Join("\n\n", e.Errors), FormMessage.OK);
             }

             if (isLoaded){


Host keys race fix

Host keys race fix

--- src/WebJobs.Script.WebHost/Security/KeyManagement/SecretManager.cs
+++ src/WebJobs.Script.WebHost/Security/KeyManagement/SecretManager.cs
@@ -7,6 +7,7 @@
 using System.IO;
 using System.Linq;
 using System.Security.Cryptography;
+using System.Threading;
 using System.Threading.Tasks;
 using Microsoft.Azure.WebJobs.Script.Config;
 using Microsoft.Azure.WebJobs.Script.WebHost.Properties;
@@ -21,6 +22,7 @@
         private readonly ILogger _logger;
         private readonly ISecretsRepository _repository;
         private HostSecretsInfo _hostSecrets;
+        private SemaphoreSlim _semaphoreSlim = new SemaphoreSlim(1, 1);

         // for testing
         public SecretManager()
@@ -65,43 +67,53 @@
         {
             if (_hostSecrets == null)
             {
-                HostSecrets hostSecrets = await LoadSecretsAsync<HostSecrets>();
-
-                if (hostSecrets == null)
-                {
-                    // host secrets do not yet exist so generate them
-                    _logger.LogDebug(Resources.TraceHostSecretGeneration);
-                    hostSecrets = GenerateHostSecrets();
-                    await PersistSecretsAsync(hostSecrets);
-                }
-
+                HostSecrets hostSecrets;
+                // Allow only one thread to modify the secrets
+                await _semaphoreSlim.WaitAsync();
                 try
                 {
-                    // Host secrets will be in the original persisted state at this point (e.g. encrypted),
-                    // so we read the secrets running them through the appropriate readers
-                    hostSecrets = ReadHostSecrets(hostSecrets);
-                }
-                catch (CryptographicException)
-                {
-                    _logger?.LogDebug(Resources.TraceNonDecryptedHostSecretRefresh);
-                    await PersistSecretsAsync(hostSecrets, null, true);
-                    await RefreshSecretsAsync(hostSecrets);
-                }
-
-                // If the persistence state of any of our secrets is stale (e.g. the encryption key has been rotated), update
-                // the state and persist the secrets
-                if (hostSecrets.HasStaleKeys)
-                {
-                    _logger.LogDebug(Resources.TraceStaleHostSecretRefresh);
-                    await RefreshSecretsAsync(hostSecrets);
-                }
-
-                _hostSecrets = new HostSecretsInfo
-                {
-                    MasterKey = hostSecrets.MasterKey.Value,
-                    FunctionKeys = hostSecrets.FunctionKeys.ToDictionary(s => s.Name, s => s.Value),
-                    SystemKeys = hostSecrets.SystemKeys.ToDictionary(s => s.Name, s => s.Value)
-                };
+                    hostSecrets = await LoadSecretsAsync<HostSecrets>();
+
+                    if (hostSecrets == null)
+                    {
+                        // host secrets do not yet exist so generate them
+                        _logger.LogDebug(Resources.TraceHostSecretGeneration);
+                        hostSecrets = GenerateHostSecrets();
+                        await PersistSecretsAsync(hostSecrets);
+                    }
+
+                    try
+                    {
+                        // Host secrets will be in the original persisted state at this point (e.g. encrypted),
+                        // so we read the secrets running them through the appropriate readers
+                        hostSecrets = ReadHostSecrets(hostSecrets);
+                    }
+                    catch (CryptographicException)
+                    {
+                        _logger?.LogDebug(Resources.TraceNonDecryptedHostSecretRefresh);
+                        await PersistSecretsAsync(hostSecrets, null, true);
+                        await RefreshSecretsAsync(hostSecrets);
+                    }
+
+                    // If the persistence state of any of our secrets is stale (e.g. the encryption key has been rotated), update
+                    // the state and persist the secrets
+                    if (hostSecrets.HasStaleKeys)
+                    {
+                        _logger.LogDebug(Resources.TraceStaleHostSecretRefresh);
+                        await RefreshSecretsAsync(hostSecrets);
+                    }
+
+                    _hostSecrets = new HostSecretsInfo
+                    {
+                        MasterKey = hostSecrets.MasterKey.Value,
+                        FunctionKeys = hostSecrets.FunctionKeys.ToDictionary(s => s.Name, s => s.Value),
+                        SystemKeys = hostSecrets.SystemKeys.ToDictionary(s => s.Name, s => s.Value)
+                    };
+                }
+                finally
+                {
+                    _semaphoreSlim.Release();
+                }
             }

             return _hostSecrets;


update to version 1.0.0

update to version 1.0.0

--- src/WebApiContrib.IoC.CastleWindsor/Properties/AssemblyInfo.cs
+++ src/WebApiContrib.IoC.CastleWindsor/Properties/AssemblyInfo.cs
@@ -31,5 +31,5 @@
 //
 // You can specify all the values or you can default the Build and Revision Numbers
 // by using the '*' as shown below:
-[assembly: AssemblyVersion("0.10.0")]
-[assembly: AssemblyFileVersion("0.10.0")]
+[assembly: AssemblyVersion("1.0.0")]
+[assembly: AssemblyFileVersion("1.0.0")]


Adding additional logs for secret regenerations.

--- src/WebJobs.Script.WebHost/Security/KeyManagement/SecretManager.cs
+++ src/WebJobs.Script.WebHost/Security/KeyManagement/SecretManager.cs
@@ -16,6 +16,7 @@
 using Microsoft.Azure.WebJobs.Script.Diagnostics;
 using Microsoft.Azure.WebJobs.Script.WebHost.Properties;
 using Microsoft.Extensions.Logging;
+using DataProtectionCostants = Microsoft.Azure.Web.DataProtection.Constants;

 namespace Microsoft.Azure.WebJobs.Script.WebHost
 {
@@ -459,14 +460,6 @@
             ScriptSecretsType secretsType = secrets.SecretsType;
             if (isNonDecryptable)
             {
-                string decryptionKey = SystemEnvironment.Instance.GetEnvironmentVariable(EnvironmentSettingNames.WebSiteAuthEncryptionKey);
-                if (!string.IsNullOrEmpty(decryptionKey))
-                {
-                    SHA256Managed hash = new SHA256Managed();
-                    byte[] hashBytes = hash.ComputeHash(Encoding.UTF8.GetBytes(decryptionKey));
-                    secrets.DecryptionKeyId = Convert.ToBase64String(hashBytes);
-                }
-
                 string[] secretBackups = await _repository.GetSecretSnapshots(secrets.SecretsType, keyScope);

                 if (secretBackups.Length >= ScriptConstants.MaximumSecretBackupCount)
@@ -479,6 +472,11 @@
             }
             else
             {
+                // We want to store encryption keys hashes to investigate sudden regenerations
+                string hashes = GetEncryptionKeysHashes();
+                secrets.DecryptionKeyId = hashes;
+                _logger?.LogInformation("Encription keys hashes: {0}", hashes);
+
                 await _repository.WriteAsync(secretsType, keyScope, secrets);
             }
         }
@@ -594,5 +592,29 @@
         {
             return (secretsType == ScriptSecretsType.Function) ? keyScope : null;
         }
+
+        private string GetEncryptionKeysHashes()
+        {
+            string result = string.Empty;
+            string azureWebsiteLocalEncryptionKey = SystemEnvironment.Instance.GetEnvironmentVariable(DataProtectionCostants.AzureWebsiteLocalEncryptionKey) ?? string.Empty;
+            SHA256Managed hash = new SHA256Managed();
+
+            if (!string.IsNullOrEmpty(azureWebsiteLocalEncryptionKey))
+            {
+                byte[] hashBytes = hash.ComputeHash(Encoding.UTF8.GetBytes(azureWebsiteLocalEncryptionKey));
+                string azureWebsiteLocalEncryptionKeyHash = Convert.ToBase64String(hashBytes);
+                result += $"{DataProtectionCostants.AzureWebsiteLocalEncryptionKey}={azureWebsiteLocalEncryptionKeyHash};";
+            }
+
+            string azureWebsiteEnvironmentMachineKey = SystemEnvironment.Instance.GetEnvironmentVariable(DataProtectionCostants.AzureWebsiteEnvironmentMachineKey) ?? string.Empty;
+            if (!string.IsNullOrEmpty(azureWebsiteEnvironmentMachineKey))
+            {
+                byte[] hashBytes = hash.ComputeHash(Encoding.UTF8.GetBytes(azureWebsiteEnvironmentMachineKey));
+                string azureWebsiteEnvironmentMachineKeyHash = Convert.ToBase64String(hashBytes);
+                result += $"{DataProtectionCostants.AzureWebsiteEnvironmentMachineKey}={azureWebsiteEnvironmentMachineKeyHash};";
+            }
+
+            return result;
+        }
     }
 }


option to preserve material when wrapping mesh GO

--- unity/UnitySceneUtil.cs
+++ unity/UnitySceneUtil.cs
@@ -13,12 +13,18 @@
         // converts input GameObject into a DMeshSO. Original GameObject is not used by DMeshSO,
         // so it can be destroyed.
         // [TODO] transfer materials!!
-        public static TransformableSO WrapMeshGameObject(GameObject wrapGO, FContext context, bool bDestroyOriginal)
+        public static TransformableSO WrapMeshGameObject(GameObject wrapGO, FContext context, bool bDestroyOriginal, bool bPreserveColor = true)
         {
+            SOMaterial overrideMaterial = null;
+            if (bPreserveColor) {
+                if (wrapGO.GetMaterial() != null)
+                    overrideMaterial = MaterialUtil.FromUnityMaterial(wrapGO.GetMaterial());
+            }
             var wrapperSO = ImportExistingUnityMesh(wrapGO, context.Scene, true, true, true,
                         (mesh, material) => {
                             DMeshSO gso = new DMeshSO();
-                            return gso.Create(UnityUtil.UnityMeshToDMesh(mesh, false), material);
+                            var useMaterial = (overrideMaterial != null) ? overrideMaterial : material;
+                            return gso.Create(UnityUtil.UnityMeshToDMesh(mesh, false), useMaterial);
                         } );
             if ( bDestroyOriginal )
                 GameObject.Destroy(wrapGO);


Limit the list start to 8 digits. See also https://github.com/jgm/cmark/commit/76fb4d57b9e941870c72f86833648bb5262be737

--- CommonMark/Parser/BlockMethods.cs
+++ CommonMark/Parser/BlockMethods.cs
@@ -362,7 +362,8 @@
                 while (pos < len - 1)
                 {
                     c = ln[++pos];
-                    if (c >= '0' && c <= '9')
+                    // We limit to 9 digits to avoid overflow, This also seems to be the limit for 'start' in some browsers.
+                    if (c >= '0' && c <= '9' && start < 100000000)
                         start = start * 10 + (c - '0');
                     else
                         break;


Added application name/version data to cloud logger

--- Controller/NLogSettingsManager.cs
+++ Controller/NLogSettingsManager.cs
@@ -4,6 +4,7 @@
     using System.IO;
     using System.Text;
     using DW.ELA.Interfaces;
+    using DW.ELA.Utility;
     using NLog;
     using NLog.Layouts;
     using NLog.Targets;
@@ -52,7 +53,7 @@
             if (settingsProvider?.Settings?.ReportErrorsToCloud ?? false)
             {
                 var webCollector = new WebServiceTarget() { Protocol = WebServiceProtocol.JsonPost, Url = new Uri(CloudErrorReportingUrl) };
-                webCollector.Parameters.Add(new MethodCallParameter(string.Empty, GetDefaultJsonLayout()));
+                webCollector.Parameters.Add(new MethodCallParameter(string.Empty, GetCloudErrorLayout()));
                 var asyncWrapper = new AsyncTargetWrapper()
                 {
                     OverflowAction = AsyncTargetWrapperOverflowAction.Discard,
@@ -73,7 +74,7 @@
         }

 #pragma warning disable SA1118 // Parameter must not span multiple lines
-        private Layout GetDefaultJsonLayout()
+        private JsonLayout GetDefaultJsonLayout()
         {
             return new JsonLayout()
             {
@@ -83,35 +84,45 @@
                         new JsonAttribute("time", "${longdate}"),
                         new JsonAttribute("message", "${message}"),
                         new JsonAttribute("logger", "${logger}"),
-                        new JsonAttribute("exception", new JsonLayout()
-                        {
-                            Attributes =
+                        new JsonAttribute("exception",
+                            new JsonLayout()
                             {
-                                new JsonAttribute("type", "${exception:format=ShortType}"),
-                                new JsonAttribute("message", "${exception:format=Message}"),
-                                new JsonAttribute("data", "${exception:format=Data}"),
-                                new JsonAttribute("stackTrace", "${exception:format=StackTrace}"),
-                                new JsonAttribute("innerException", new JsonLayout()
+                                Attributes =
                                 {
-                                    Attributes =
-                                    {
-                                        new JsonAttribute("type", "${exception:format=:innerFormat=ShortType:MaxInnerExceptionLevel=1:InnerExceptionSeparator="),
-                                        new JsonAttribute("message", "${exception:format=:innerFormat=Message:MaxInnerExceptionLevel=1:InnerExceptionSeparator="),
-                                        new JsonAttribute("data", "${exception:format=:innerFormat=Data:MaxInnerExceptionLevel=1:InnerExceptionSeparator="),
-                                        new JsonAttribute("stackTrace", "${exception:format=:innerFormat=StackTrace:MaxInnerExceptionLevel=1:InnerExceptionSeparator="),
-                                    },
-                                    RenderEmptyObject = false
+                                    new JsonAttribute("type", "${exception:format=ShortType}"),
+                                    new JsonAttribute("message", "${exception:format=Message}"),
+                                    new JsonAttribute("data", "${exception:format=Data}"),
+                                    new JsonAttribute("stackTrace", "${exception:format=StackTrace}"),
+                                    new JsonAttribute("innerException",
+                                        new JsonLayout()
+                                        {
+                                            Attributes =
+                                            {
+                                                new JsonAttribute("type", "${exception:format=:innerFormat=ShortType:MaxInnerExceptionLevel=1:InnerExceptionSeparator="),
+                                                new JsonAttribute("message", "${exception:format=:innerFormat=Message:MaxInnerExceptionLevel=1:InnerExceptionSeparator="),
+                                                new JsonAttribute("data", "${exception:format=:innerFormat=Data:MaxInnerExceptionLevel=1:InnerExceptionSeparator="),
+                                                new JsonAttribute("stackTrace", "${exception:format=:innerFormat=StackTrace:MaxInnerExceptionLevel=1:InnerExceptionSeparator="),
+                                            },
+                                            RenderEmptyObject = false
+                                        },
+                                        false)
                                 },
-                                false)
+                                RenderEmptyObject = false
                             },
-                            RenderEmptyObject = false
-                        },
-                        false)
+                            false)
                     },
                 RenderEmptyObject = false,
                 IncludeAllProperties = true,
                 ExcludeProperties = { "CallerFilePath", "CallerLineNumber", "CallerMemberName" }
             };
+        }
+
+        private JsonLayout GetCloudErrorLayout()
+        {
+            var layout = GetDefaultJsonLayout();
+            layout.Attributes.Add(new JsonAttribute("application", AppInfo.Name));
+            layout.Attributes.Add(new JsonAttribute("version", AppInfo.Version));
+            return layout;
         }
 #pragma warning restore SA1118 // Parameter must not span multiple lines


Show only button part of keytip on Splitbutton

--- Fluent.Ribbon/Controls/SplitButton.cs
+++ Fluent.Ribbon/Controls/SplitButton.cs
@@ -540,11 +540,11 @@
                 this.ApplyTemplate();
             }

-            yield return new KeyTipInformation(this.KeyTip + "A", this.button, hide)
+            yield return new KeyTipInformation(this.KeyTip, this.button, hide)
             {
                 VisualTarget = this
             };
-            yield return new KeyTipInformation(this.KeyTip + "B", this, hide);
+            //yield return new KeyTipInformation(this.KeyTip + "B", this, hide);
         }

         #endregion


fix nullref with GetListing LoadBasicListingInfo

--- FluentFTP/Client/FtpClient_Listing.cs
+++ FluentFTP/Client/FtpClient_Listing.cs
@@ -716,7 +716,6 @@
 			var lst = new List<FtpListItem>();
 			var rawlisting = new List<string>();
 			string listcmd = null;
-			string buf = null;

 			// read flags
 			var isIncludeSelf = options.HasFlag(FtpListOption.IncludeSelfAndParent);
@@ -742,10 +741,13 @@
 			for (var i = 0; i < rawlisting.Count; i++) {
 				string rawEntry = rawlisting[i];

+				// break if task is cancelled
+				token.ThrowIfCancellationRequested();
+
 				if (!isNameList) {

 					// load basic information available within the file listing
-					if (!LoadBasicListingInfo(ref path, ref item, lst, rawlisting, ref i, listcmd, buf, isRecursive, isIncludeSelf, machineList)) {
+					if (!LoadBasicListingInfo(ref path, ref item, lst, rawlisting, ref i, listcmd, rawEntry, isRecursive, isIncludeSelf, machineList)) {

 						// skip unwanted listings
 						continue;
@@ -825,7 +827,6 @@
 			var lst = new List<FtpListItem>();
 			var rawlisting = new List<string>();
 			string listcmd = null;
-			string buf = null;

 			// read flags
 			var isIncludeSelf = options.HasFlag(FtpListOption.IncludeSelfAndParent);
@@ -851,10 +852,13 @@
 			for (var i = 0; i < rawlisting.Count; i++) {
 				string rawEntry = rawlisting[i];

+				// break if task is cancelled
+				token.ThrowIfCancellationRequested();
+
 				if (!isNameList) {

 					// load basic information available within the file listing
-					if (!LoadBasicListingInfo(ref path, ref item, lst, rawlisting, ref i, listcmd, buf, isRecursive, isIncludeSelf, machineList)) {
+					if (!LoadBasicListingInfo(ref path, ref item, lst, rawlisting, ref i, listcmd, rawEntry, isRecursive, isIncludeSelf, machineList)) {

 						// skip unwanted listings
 						continue;
@@ -871,9 +875,6 @@
 		}

 		private async Task<FtpListItem> GetListingProcessItemAsync(FtpListItem item, List<FtpListItem> lst, string rawEntry, string listcmd, CancellationToken token, bool isIncludeSelf, bool isNameList, bool isRecursive, bool isDerefLinks, bool isGetModified, bool isGetSize) {
-
-			// break if task is cancelled
-			token.ThrowIfCancellationRequested();

 			if (isNameList) {
 				// if NLST was used we only have a file name so


PG-387: Fixed crash caused by keeping Assign Character button enabled when list is cleared and re-loaded.


New array evaluation and splitting function implemented

--- Guybrush101/Core/EngineClassSwitch.cs
+++ Guybrush101/Core/EngineClassSwitch.cs
@@ -47,8 +47,14 @@

+        private bool MaxThrustEmpty = true;
+        private bool EngineTypesEmpty = true;
+
+        private bool heatProductionEmpty = true;

         private bool propellantIgnoreForIspEmpty = true;
+        private bool propellantDrawGaugeEmpty = true;
+
         private bool atmosphereCurveEmpty = true;
         private bool velCurveEmpty = true;
         private bool atmCurveEmpty = true;
@@ -103,6 +109,7 @@
             //Debug.Log("EngineClassSwitch --> InitializeSettings");
             if (!_settingsInitialized)
             {
+                Utilities Util = new Utilities();
                 //try
                 //{
                 #region GUI Update
@@ -123,40 +130,23 @@

                 #region Parse Arrays
                 //Parse the strings into arrays of information
+                //Propellant names and ratios are mandatory information
+
+                //Propellant level
                 arrPropellantNames = propellantNames.Trim().Split(';');        //arrPropellantNames should now have the propellant names and combinations
                 arrPropellantRatios = propellantRatios.Trim().Split(';');      //arrPropellantRatios should now have the propellant ratios and combinations
-                arrMaxThrust = maxThrust.Trim().Split(';');
-                //arrPropIgnoreForISP = propellantIgnoreForIsp.Trim().Split(';');
-                arrPropDrawGauge = propellantDrawGauge.Trim().Split(';');
-                arrHeatProd = heatProduction.Trim().Split(';');
-                arrEngineTypes = EngineTypes.Trim().Split(';');
-
-
-                propellantIgnoreForIspEmpty = ((string.IsNullOrEmpty(propellantIgnoreForIsp) || propellantIgnoreForIsp.Trim().Length == 0));
-                atmosphereCurveEmpty = ((string.IsNullOrEmpty(atmosphereCurveKeys) || atmosphereCurveKeys.Trim().Length == 0));
-                velCurveEmpty = ((string.IsNullOrEmpty(velCurveKeys) || velCurveKeys.Trim().Length == 0));
-                atmCurveEmpty = ((string.IsNullOrEmpty(atmCurveKeys) || velCurveKeys.Trim().Length == 0));
-
-
-                if (!propellantIgnoreForIspEmpty)
-                {
-                    arrPropIgnoreForISP = propellantIgnoreForIsp.Trim().Split(';');
-                }
-                if (!atmosphereCurveEmpty)
-                {
-                    //Debug.Log("arrAtmosphereCurve --> splitting the array based on\n" + atmosphereCurveKeys);
-                    arrAtmosphereCurve = atmosphereCurveKeys.Split('|');
-                }
-                if (!velCurveEmpty)
-                {
-                    //Debug.Log("arrPropellantVelCurve --> splitting the array based on\n" + velCurveKeys);
-                    arrPropellantVelCurve = velCurveKeys.Split('|');
-                }
-                if (!atmCurveEmpty)
-                {
-                    //Debug.Log("arrPropellantAtmCurve --> splitting the array based on\n" + atmCurveKeys);
-                    arrPropellantAtmCurve = atmCurveKeys.Split('|');
-                }
+                propellantIgnoreForIspEmpty = Util.ArraySplitEvaluate(propellantIgnoreForIsp, out arrPropIgnoreForISP, ';');
+                propellantDrawGaugeEmpty = Util.ArraySplitEvaluate(propellantDrawGauge, out arrPropDrawGauge, ';');
+
+                //Engine level
+                MaxThrustEmpty              = Util.ArraySplitEvaluate(maxThrust, out arrMaxThrust, ';');
+                EngineTypesEmpty            = Util.ArraySplitEvaluate(EngineTypes, out arrEngineTypes, ';');
+                heatProductionEmpty         = Util.ArraySplitEvaluate(heatProduction, out arrHeatProd, ';');
+
+                //Engine level curves
+                atmosphereCurveEmpty        = Util.ArraySplitEvaluate(atmosphereCurveKeys, out arrAtmosphereCurve,'|');
+                velCurveEmpty               = Util.ArraySplitEvaluate(velCurveKeys, out arrPropellantVelCurve, '|');
+                atmCurveEmpty               = Util.ArraySplitEvaluate(atmCurveKeys, out arrPropellantAtmCurve, '|');

                 //Test if the two arrays are compatible                 <------ This test should be extended!
                 if (arrPropellantNames.Length != arrPropellantRatios.Length)
@@ -181,16 +171,20 @@
                             setMaxThrust = arrMaxThrust[i],
                             //propIgnoreForISP = arrPropIgnoreForISP[i],
                             propDrawGauge = arrPropDrawGauge[i],
-                            heatProduction = arrHeatProd[i],
+                            //heatProduction = arrHeatProd[i],
                             engineType = arrEngineTypes[i]
                         });

-
-
-                        if (!propellantIgnoreForIspEmpty)
-                        {
-                            propList[i].propIgnoreForISP = arrPropIgnoreForISP[i];
-                        }
+
+                        //Propellant level --> Propellant level is needed as the entire node is replaced.
+                        propList[i].propIgnoreForISP    = propellantIgnoreForIspEmpty  ? "false"   : arrPropIgnoreForISP[i];        //Has Default value "false"
+
+                        //Engine level
+                        propList[i].engineType          = EngineTypesEmpty             ? ""        : arrEngineTypes[i];
+                        propList[i].heatProduction      = heatProductionEmpty          ? "0"       : arrHeatProd[i];
+
+
+
                         if (!atmosphereCurveEmpty)
                         {
                             propList[i].atmosphereCurve = arrAtmosphereCurve[i];
@@ -257,7 +251,7 @@
             float floatParseResult;

             ConfigNode newPropNode = new ConfigNode();
-            CurveUtilities MiscFx = new CurveUtilities();
+            Utilities MiscFx = new Utilities();
             PhysicsUtilities EngineCalc = new PhysicsUtilities();
             //PartResourceDefinitionList resourceID;

@@ -356,7 +350,7 @@
                     Density: propList[selectedPropellant].propDensity,
                     ISP: maxISP
                     );
-                if (Single.TryParse(propList[selectedPropellant].heatProduction, out floatParseResult))
+                if (Single.TryParse(propList[selectedPropellant].heatProduction, out floatParseResult) && !heatProductionEmpty)
                 { moduleEngine.heatProduction = floatParseResult; }

                 //Set the engine type
@@ -389,6 +383,9 @@
                         break;
                     case "Piston":
                         moduleEngine.engineType = EngineType.Piston;
+                        break;
+                    default:
+                        moduleEngine.engineType = EngineType.LiquidFuel;
                         break;
                 }


Double Click on tag starts a new search

Double Click on tag starts a new search

--- CryPixivClient/MainWindow.xaml.cs
+++ CryPixivClient/MainWindow.xaml.cs
@@ -750,6 +750,18 @@
                 var tt = lstBox.SelectedItem as Translation;
                 if (tt != null) txtSearchQuery.Text = tt.Original;
             };
+            lstBox.MouseDoubleClick += async (a, b) =>
+            {
+                var tt = lstBox.SelectedItem as Translation;
+                if (tt != null) txtSearchQuery.Text = tt.Original;
+
+                if (IsSearching)
+                {
+                    btnSearch_Click(this, null);
+                    await Task.Delay(300);
+                }
+                btnSearch_Click(this, null);
+            };

             popupTags.AddContent(txt, lstBox);


Some improvements in Base85.cs - improve encode speed.

--- CustomBlocks/Converters/Base85.cs
+++ CustomBlocks/Converters/Base85.cs
@@ -46,13 +46,18 @@

 	public static class Base85
 	{
-		//start mark sequence. BStartMark - ascii version of StartMark. used in encode
+		//start mark sequence. BStartMark - version of StartMark. used in encode
 		private const string StartMark = "<~";
-		private static readonly byte[] BStartMark = { 60, 126 };
-
-		//end mark sequence. BEndMark - ascii version of EndMark, used in encode
+		private const char BStartMark_1 = '<';
+		private const char BStartMark_2 = '~';
+
+		//end mark sequence. BEndMark - version of EndMark, used in encode
 		private const string EndMark = "~>";
-		private static readonly byte[] BEndMark = { 126, 62 };
+		private const char BEndMark_1 = '~';
+		private const char BEndMark_2 = '>';
+
+		//empty string with marks, used when encoding null or empty data byte arrays with error check is disabled
+		private const string EmptyStringWithMarks = "<~~>";

 		//using in decode to fast select proper "power of 85" value
 		private static readonly uint[] pow85 = { 52200625U, 614125U, 7225U, 85U, 1U };
@@ -199,42 +204,21 @@
 		{
 			if(data == null && !ignoreErrors)
 				throw new ArgumentNullException("data", "Input byte array cannot be null");
-			//7-bit-ascii strings will be generated
-			var encoding = Encoding.GetEncoding("us-ascii", new EncoderExceptionFallback(), new DecoderReplacementFallback(" "));
 			if(data == null || data.Length == 0)
-			{
-				if(useMarks)
-				{
-					var empty = new byte[BStartMark.Length + BEndMark.Length];
-					int ePos = 0;
-					for(int i = 0; i < BStartMark.Length; ++i)
-					{
-						empty[ePos] = BStartMark[i];
-						ePos++;
-					}
-					for(int i = 0; i < BEndMark.Length; ++i)
-					{
-						empty[ePos] = BEndMark[i];
-						ePos++;
-					}
-					return encoding.GetString(empty);
-				}
-				else
-					return string.Empty;
-			}
+				return useMarks ? EmptyStringWithMarks : string.Empty;
 			//pos
 			int rPos = 0;
 			//calculate how much space we need
 			var fullchunks = data.Length / 4;
 			var remainder = data.Length % 4;
-			var result = new byte[fullchunks * 5 + (remainder > 0 ? 5 : 0) + (useMarks ? BStartMark.Length + BEndMark.Length : 0)];
+			var result = new char[fullchunks * 5 + (remainder > 0 ? 5 : 0) + (useMarks ? 4 /*start+end marks len*/ : 0)];
 			//append start mark
 			if(useMarks)
-				for(int i = 0; i < BStartMark.Length; ++i)
-				{
-					result[rPos] = BStartMark[i];
-					rPos++;
-				}
+			{
+				result[rPos] = BStartMark_1;
+				result[rPos + 1] = BStartMark_2;
+				rPos+=2;
+			}
 			//encode full chunks
 			uint tuple = 0U;
 			//process full chunks
@@ -246,16 +230,16 @@
 				tuple |= (uint)data[4 * i + 3];
 				if(tuple == 0U)
 				{
-					result[rPos] = 122;
+					result[rPos] = 'z';
 					rPos++;
 				}
 				else
 				{
-					result[rPos + 4] = (byte)((tuple % 85U) + 33U);
-					result[rPos + 3] = (byte)((tuple / 85U % 85U) + 33U);
-					result[rPos + 2] = (byte)((tuple / 7225U % 85U) + 33U);
-					result[rPos + 1] = (byte)((tuple / 614125U % 85U) + 33U);
-					result[rPos] = (byte)((tuple / 52200625U % 85U) + 33U);
+					result[rPos + 4] = (char)((tuple % 85U) + 33U);
+					result[rPos + 3] = (char)((tuple / 85U % 85U) + 33U);
+					result[rPos + 2] = (char)((tuple / 7225U % 85U) + 33U);
+					result[rPos + 1] = (char)((tuple / 614125U % 85U) + 33U);
+					result[rPos] = (char)((tuple / 52200625U % 85U) + 33U);
 					rPos += 5;
 					tuple = 0U;
 				}
@@ -265,20 +249,21 @@
 			{
 				for(int i = 0; i < remainder; ++i)
 					tuple |= (uint)data[4 * fullchunks + i] << (24 - i * 8);
-				result[rPos + 4] = (byte)((tuple % 85U) + 33U);
-				result[rPos + 3] = (byte)((tuple / 85U % 85U) + 33U);
-				result[rPos + 2] = (byte)((tuple / 7225U % 85U) + 33U);
-				result[rPos + 1] = (byte)((tuple / 614125U % 85U) + 33U);
-				result[rPos] = (byte)((tuple / 52200625U % 85U) + 33U);
+				result[rPos + 4] = (char)((tuple % 85U) + 33U);
+				result[rPos + 3] = (char)((tuple / 85U % 85U) + 33U);
+				result[rPos + 2] = (char)((tuple / 7225U % 85U) + 33U);
+				result[rPos + 1] = (char)((tuple / 614125U % 85U) + 33U);
+				result[rPos] = (char)((tuple / 52200625U % 85U) + 33U);
 				rPos += (remainder + 1);
 			}
 			if(useMarks)
-				for(int i = 0; i < BEndMark.Length; ++i)
-				{
-					result[rPos] = BEndMark[i];
-					rPos++;
-				}
-			return encoding.GetString(result, 0, rPos);
+			{
+				result[rPos] = BEndMark_1;
+				result[rPos + 1] = BEndMark_2;
+				rPos+=2;
+			}
+			//7-bit-ascii strings will be generated, no need to use additional Encoding
+			return new string(result, 0, rPos);
 		}
 	}
 }


WIP: SafeEvent class: moved IL generation stuff to dedicated static class, buf fixes and improvements

- Fixes in handle class for object instances;
- Use only one instance of delegate for one unique method info
- Generated dynamic method is static now
- Added cache for generated dynamic methods

--- CustomBlocks/Events/SafeEvents.cs
+++ CustomBlocks/Events/SafeEvents.cs
@@ -30,9 +30,70 @@

 namespace DarkCaster.Events
 {
-	public static class SafeEventPublisher
+	internal static class SafeEventPublisher
 	{
-		public static readonly MethodInfo GetStrongRef = typeof(WeakReference).GetMethod("get_Target");
+		internal static readonly MethodInfo GetStrongRef = typeof(WeakReference).GetMethod("get_Target");
+
+		internal static readonly Type[] dynamicForwarderParams = new Type[] { typeof(WeakReference)/*weakRefToSubscriber*/, typeof(object)/*sender*/, typeof(EventArgs)/*event args*/ };
+		internal delegate bool DynamicForwarder(WeakReference reference, object sender, EventArgs args);
+
+		internal sealed class DynamicWeakHandle
+		{
+			public readonly MethodInfo method;
+			public readonly WeakReference weakTarget;
+			public readonly DynamicForwarder forwarder;
+
+			public DynamicWeakHandle(MethodInfo method, object target, bool generateForwarder = false)
+			{
+				this.weakTarget = new WeakReference(target);
+				this.method = method;
+				this.forwarder = generateForwarder ? GenerateDynamicForwarder(method) : null;
+			}
+
+			public override bool Equals(object obj)
+			{
+				if(!(obj is DynamicWeakHandle))
+					return false;
+				var other = (DynamicWeakHandle)obj;
+				return method == other.method && ReferenceEquals(weakTarget.Target, other.weakTarget.Target);
+			}
+
+			public override int GetHashCode()
+			{
+				return method.GetHashCode();
+			}
+		}
+
+		private static Dictionary<MethodInfo, DynamicForwarder> dynamicForwarderCache = new Dictionary<MethodInfo, DynamicForwarder>();
+
+		private static DynamicForwarder GenerateDynamicForwarder(MethodInfo method)
+		{
+			lock(dynamicForwarderCache)
+			{
+				if(dynamicForwarderCache.ContainsKey(method))
+					return dynamicForwarderCache[method];
+				var dynMethod = new DynamicMethod("InvokeEventOnObject", typeof(bool), dynamicForwarderParams, true);
+				var generator = dynMethod.GetILGenerator();
+				generator.Emit(OpCodes.Ldarg_0); //stack: weakRef
+				generator.Emit(OpCodes.Call, GetStrongRef); //stack: weakRef.Target
+				generator.Emit(OpCodes.Dup); //stack: weakRef.Target, weakRef.Target
+				var continueLabel = generator.DefineLabel();
+				generator.Emit(OpCodes.Brtrue_S, continueLabel); //stack: weakRef.Target
+				generator.Emit(OpCodes.Pop); //stack: [empty]
+				generator.Emit(OpCodes.Ldc_I4_S, 0); //stack: 0(false)
+				generator.Emit(OpCodes.Ret);
+				generator.MarkLabel(continueLabel); //stack: weakRef.Target
+				generator.Emit(OpCodes.Castclass, method.DeclaringType); //stack: (EventHandler<T>)weakRef.Target
+				generator.Emit(OpCodes.Ldarg_1); //stack: (EventHandler<T>)weakRef.Target, sender
+				generator.Emit(OpCodes.Ldarg_2); //stack: (EventHandler<T>)weakRef.Target, sender, args
+				generator.Emit(OpCodes.Call, method); //stack: [empty]
+				generator.Emit(OpCodes.Ldc_I4_S, 1); //stack: 1(true)
+				generator.Emit(OpCodes.Ret);
+				var result=(DynamicForwarder)dynMethod.CreateDelegate(typeof(DynamicForwarder));
+				dynamicForwarderCache.Add(method, result);
+				return result;
+			}
+		}
 	}

 	/// <summary>
@@ -46,81 +107,8 @@
 	/// </summary>
 	public class SafeEventPublisher<T> : IEventPublisher<T> where T : EventArgs
 	{
-		private delegate bool Forwarder(object sender, T args);
-		private static readonly Type[] forwarderTypes = new Type[] { typeof(DynamicWrapper)/*this*/, typeof(object)/*sender*/, typeof(T)/*event args*/ };
-		private static readonly FieldInfo weakRefField = typeof(DynamicWrapper).GetField("target", BindingFlags.NonPublic | BindingFlags.Instance);
-
-		private sealed class DynamicWrapper
-		{
-			private readonly MethodInfo method;
-			private readonly WeakReference target;
-
-			public readonly Forwarder forwarder;
-
-			public DynamicWrapper(MethodInfo method, object target, bool generateForwarder=true)
-			{
-				if(target == null)
-					this.target = null;
-				else
-					this.target = new WeakReference(target);
-				this.method = method;
-				if(!generateForwarder)
-					forwarder = null;
-				else
-					forwarder = GenerateForwarder(target == null);
-			}
-
-			private Forwarder GenerateForwarder(bool isStatic)
-			{
-				var dynMethod = new DynamicMethod("InvokeEventOnObject", typeof(bool), forwarderTypes, typeof(DynamicWrapper), true);
-				var generator = dynMethod.GetILGenerator();
-				if(isStatic)
-				{
-					throw new NotImplementedException("TODO");
-				}
-				else
-				{
-					generator.Emit(OpCodes.Ldarg_0); //stack: this
-					generator.Emit(OpCodes.Ldfld, weakRefField); //stack: this.target
-					generator.Emit(OpCodes.Call, SafeEventPublisher.GetStrongRef); //stack: this.target.Target
-					generator.Emit(OpCodes.Dup); //stack: this.target.Target, this.target.Target
-					var continueLabel = generator.DefineLabel();
-					generator.Emit(OpCodes.Brtrue_S, continueLabel); //stack: this.target.Target
-					generator.Emit(OpCodes.Pop); //stack:
-					generator.Emit(OpCodes.Ldc_I4_S, 0); //stack: 0(false)
-					generator.Emit(OpCodes.Ret);
-					generator.MarkLabel(continueLabel); //stack: this.target.Target
-					generator.Emit(OpCodes.Castclass, method.DeclaringType); //stack: (EventHandler<T>)this.target.Target
-					generator.Emit(OpCodes.Ldarg_1);
-					generator.Emit(OpCodes.Ldarg_2);
-					generator.Emit(OpCodes.Call, method);
-					generator.Emit(OpCodes.Ldc_I4_S, 1); //stack: 1(true)
-					generator.Emit(OpCodes.Ret);
-				}
-				return (Forwarder)dynMethod.CreateDelegate(typeof(Forwarder), this);
-			}
-
-			public override bool Equals(object obj)
-			{
-				if(!(obj is DynamicWrapper))
-					return false;
-				var other = (DynamicWrapper)obj;
-				if(target==null && other.target==null)
-					return method == other.method;
-				if(target != null && other.target != null)
-					return method == other.method && target.Target == other.target.Target;
-				return false;
-			}
-
-			public override int GetHashCode()
-			{
-				return method.GetHashCode();
-			}
-		}
-
 		//TODO: check other structures for effectiveness
-		private readonly HashSet<DynamicWrapper> subscribers = new HashSet<DynamicWrapper>();
-
+		private readonly HashSet<SafeEventPublisher.DynamicWeakHandle> subscribers = new HashSet<SafeEventPublisher.DynamicWeakHandle>();
 		private readonly object locker = new object();

 		public void Subscribe(EventHandler<T> subscriber)
@@ -128,7 +116,7 @@
 			if(subscriber == null)
 				throw new EventSubscriptionException(null, "Failed to add a null subscriber of type " + typeof(T).FullName, null);
 			lock(locker)
-				subscribers.Add(new DynamicWrapper(subscriber.Method, subscriber.Target));
+				subscribers.Add(new SafeEventPublisher.DynamicWeakHandle(subscriber.Method, subscriber.Target, true));
 		}

 		public void Unsubscribe(EventHandler<T> subscriber)
@@ -136,14 +124,14 @@
 			if(subscriber == null)
 				throw new EventSubscriptionException(null, "Failed to add a null subscriber of type " + typeof(T).FullName, null);
 			lock(locker)
-				subscribers.Remove(new DynamicWrapper(subscriber.Method, subscriber.Target, false));
+				subscribers.Remove(new SafeEventPublisher.DynamicWeakHandle(subscriber.Method, subscriber.Target));
 		}

 		//TODO: remove obsolete elements
 		public void Raise(T args)
 		{
 			foreach(var el in subscribers)
-				el.forwarder(this, args);
+				el.forwarder(el.weakTarget, this, args);
 		}
 	}
 }


modify simul editing, fully functional

modify simul editing, fully functional

--- DBLike/Client/Threads/Uploader.cs
+++ DBLike/Client/Threads/Uploader.cs
@@ -178,7 +178,10 @@
                                         System.IO.File.Copy(sourcePath, targetPath, true);

-                                        // delete current copy
+                                    }
+                                    else if (dialogResult == DialogResult.No)
+                                    {
+
                                         // try delete while it still exists
                                         while (System.IO.File.Exists(fullpathOfChnagedFile))
                                         {
@@ -189,21 +192,6 @@

                                         }

-
-                                    }
-                                    else if (dialogResult == DialogResult.No)
-                                    {
-
-                                        // try delete while it still exists
-                                        while (System.IO.File.Exists(fullpathOfChnagedFile))
-                                        {
-                                            // delete current file
-                                            // won't delete blob file on the server
-                                            // b/c it's older than that version
-                                            System.IO.File.Delete(fullpathOfChnagedFile);
-
-                                        }
-
                                         // if file is in dic
                                         if (Client.LocalFileSysAccess.FileList.fileInfoDic.ContainsKey(fullpathOfChnagedFile))
                                         {


Modified to handle null params array, which apparently can happen with *args.

--- numpy/NumpyDotNet/ndarray.cs
+++ numpy/NumpyDotNet/ndarray.cs
@@ -1048,7 +1048,10 @@
         public object choose([ParamDictionary] IDictionary<object,object> kwargs,
                              params object[] args){
             IEnumerable<object> choices;
-            if (args.Length == 1 && args[0] is IEnumerable<object>) {
+            if (args == null) {
+                choices = new object[0];
+            }
+            else if (args.Length == 1 && args[0] is IEnumerable<object>) {
                 choices = (IEnumerable<object>)args[0];
             } else {
                 choices = args;
@@ -1133,11 +1136,11 @@
         }

         public object item(params object[] args) {
-            if (args.Length == 1 && args[0] is PythonTuple) {
+            if (args != null && args.Length == 1 && args[0] is PythonTuple) {
                 PythonTuple t = (PythonTuple)args[0];
                 args = t.ToArray();
             }
-            if (args.Length == 0) {
+            if (args == null || args.Length == 0) {
                 if (ndim == 0 || Size == 1) {
                     return GetItem(0);
                 } else {
@@ -1166,7 +1169,7 @@

         public void itemset(params object[] args) {
             // Convert args to value and args
-            if (args.Length == 0) {
+            if (args == null || args.Length == 0) {
                 throw new ArgumentException("itemset must have at least one argument");
             }
             object value = args.Last();
@@ -1286,7 +1289,9 @@
             NpyDefs.NPY_ORDER order = NpyUtil_ArgProcessing.OrderConverter(keywordArgs[0]);
             IntPtr[] newshape;
             // TODO: Add NpyArray_View call for (None) case. (Why?)
-            if (args.Length == 1 && args[0] is IList<object>) {
+            if (args == null) {
+                newshape = new IntPtr[0];
+            } else if (args.Length == 1 && args[0] is IList<object>) {
                 newshape = NpyUtil_ArgProcessing.IntpListConverter((IList<object>)args[0]);
             } else {
                 newshape = NpyUtil_ArgProcessing.IntpListConverter(args);
@@ -1301,7 +1306,7 @@
             bool refcheck = NpyUtil_ArgProcessing.BoolConverter(keywordArgs[0]);
             IntPtr[] newshape;

-            if (args.Length == 0 || args.Length == 1 && args[0] == null) {
+            if (args == null || args.Length == 0 || args.Length == 1 && args[0] == null) {
                 return;
             }
             if (args.Length == 1 && args[0] is IList<object>) {
@@ -1464,7 +1469,7 @@
         }

         public ndarray transpose(params object[] args) {
-            if (args.Length == 0 || args.Length == 1 && args[0] == null) {
+            if (args == null || args.Length == 0 || args.Length == 1 && args[0] == null) {
                 return Transpose();
             } else if (args.Length == 1 && args[0] is IList<object>) {
                 return Transpose(NpyUtil_ArgProcessing.IntpListConverter((IList<object>)args[0]));


(doc) warning on verbose/debug blended option

--- src/chocolatey/infrastructure.app/builders/ConfigurationBuilder.cs
+++ src/chocolatey/infrastructure.app/builders/ConfigurationBuilder.cs
@@ -226,6 +226,9 @@
  * **Option Bundling / Bundled Options**: One character switches can be
    bundled. e.g. `-d` (debug), `-f` (force), `-v` (verbose), and `-y`
    (confirm yes) can be bundled as `-dfvy`.
+ * ***Note:*** If `debug` or `verbose` are bundled with local options
+   (not the global ones above), some logging may not show up until after
+   the local options are parsed.
  * **Use Equals**: You can also include or not include an equals sign
    `=` between options and values.
  * **Quote Values**: When you need to quote things, such as when using