Minor fix in pwdgen CharSet parser

Minor fix in pwdgen CharSet parser

--- Examples/PasswordGenerator/Parser.cs
+++ Examples/PasswordGenerator/Parser.cs
@@ -32,7 +32,7 @@
       static Parser<IGenerator> CharSet()
       {
          return from open in Chars.Char('[')
-                from cs in Parse.Try(CharRange() | SingleChar()).Many1()
+                from cs in (Parse.Try(CharRange()) | SingleChar()).Many1()
                 from close in Chars.Char(']')
                 select (IGenerator)new CharSetGenerator(string.Concat(cs.ToArray()));
       }


Added a string.Email extension that can send an email where the string is the body

git-svn-id: 36ffe9fc6fb3fc911a0fa1910eeaa8f32b731f7d@21898 81fbe566-5dc4-48c1-bdea-7421811ca204

--- ExtensionMethods/StringExtensions.cs
+++ ExtensionMethods/StringExtensions.cs
@@ -7,6 +7,7 @@
 using System.Xml.Serialization;
 using System.Collections.Generic;
 using System.Diagnostics;
+using System.Net.Mail;

 namespace ExtensionOverflow
 {
@@ -413,6 +414,48 @@
         }
         #endregion

+        #region Email
+        /// <summary>
+        /// Send an email using the supplied string.
+        /// </summary>
+        /// <param name="body">String that will be used i the body of the email.</param>
+        /// <param name="subject">Subject of the email.</param>
+        /// <param name="sender">The email address from which the message was sent.</param>
+        /// <param name="recipient">The receiver of the email.</param>
+        /// <param name="server">The server from which the email will be sent.</param>
+        /// <returns>A boolean value indicating the success of the email send.</returns>
+        public static bool Email(this string body, string subject, string sender, string recipient, string server)
+        {
+            try
+            {
+                // To
+                MailMessage mailMsg = new MailMessage();
+                mailMsg.To.Add(recipient);
+
+                // From
+                MailAddress mailAddress = new MailAddress(sender);
+                mailMsg.From = mailAddress;
+
+                // Subject and Body
+                mailMsg.Subject = subject;
+                mailMsg.Body = body;
+
+                // Init SmtpClient and send
+                SmtpClient smtpClient = new SmtpClient(server);
+                System.Net.NetworkCredential credentials = new System.Net.NetworkCredential();
+                smtpClient.Credentials = credentials;
+
+                smtpClient.Send(mailMsg);
+            }
+            catch (Exception ex)
+            {
+                return false;
+            }
+
+            return true;
+        }
+        #endregion
+
         #region Truncate
         /// <summary>
         /// Truncates the string to a specified length and replace the truncated to a ...
@@ -527,5 +570,7 @@
             return !String.IsNullOrEmpty(input);
         }
         #endregion
+
+
     }
 }


DavidBurns: Google Chrome working on a Mac with the .NET Bindings and Mono.

git-svn-id: 4179480af2c2519a5eb5e1e9b541cbdf5cf27696@8384 07704840-8298-11de-bf8c-fd130f914ac9

--- chrome/src/csharp/webdriver-chrome/ChromeBinary.cs
+++ chrome/src/csharp/webdriver-chrome/ChromeBinary.cs
@@ -10,6 +10,13 @@
     /// </summary>
     internal class ChromeBinary
     {
+        private static readonly string[] chromePaths = new string[]
+        {
+            "/usr/bin/google-chrome",
+            "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome",
+            string.Concat("/Users/", Environment.UserName, "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome")
+        };
+
         private const int ShutdownWaitInterval = 2000;
         private const int StartWaitInterval = 2500;
         private static int linearStartWaitCoefficient = 1;
@@ -54,7 +61,7 @@
         {
             try
             {
-                chromeProcess = Process.Start(GetChromeFile(), String.Concat(Arguments, serverUrl));
+                chromeProcess = Process.Start(new ProcessStartInfo(GetChromeFile(), String.Concat(Arguments, serverUrl)) { UseShellExecute = false });
             }
             catch (IOException e)
             { // TODO(AndreNogueira): Check exception type thrown when process.start fails
@@ -69,7 +76,7 @@
         /// </summary>
         public void Kill()
         {
-            if (!(chromeProcess == null) && !chromeProcess.HasExited)
+            if ((chromeProcess != null) && !chromeProcess.HasExited)
             {
                 // Ask nicely to close.
                 chromeProcess.CloseMainWindow();
@@ -93,7 +100,7 @@
         private static string GetChromeFile()
         {
             string chromeFile = string.Empty;
-            string chromeFileSystemProperty = null; // System.getProperty("webdriver.chrome.bin");
+            string chromeFileSystemProperty = Environment.GetEnvironmentVariable("webdriver.chrome.bin");
             if (chromeFileSystemProperty != null)
             {
                 chromeFile = chromeFileSystemProperty;
@@ -110,31 +117,30 @@
                 }
                 else if (Platform.CurrentPlatform.IsPlatformType(PlatformType.Unix))
                 {
-                    chromeFile = "/usr/bin/google-chrome";
-
-                    // } else if (Platform.CurrentPlatform.IsPlatformType(PlatformType.MacOSX)) {
-                    //  string[] paths = new string[] {
-                    //    "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome",
-                    //    "/Users/" + System.getProperty("user.name") +
-                    //        "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome"};
-                    //  bool foundPath = false;
-                    //  foreach (string path in paths) {
-                    //    FileInfo binary = new FileInfo(path);
-                    //    if (binary.Exists) {
-                    //      chromeFileString.Append(binary.FullName);
-                    //      foundPath = true;
-                    //      break;
-                    //    }
-                    //  }
-                    //  if (!foundPath) {
-                    //    throw new WebDriverException("Couldn't locate Chrome.  " +
-                    //        "Set webdriver.chrome.bin");
-                    //  }
+                    // Thanks to a bug in Mono Mac and Linux will be treated the same  https://bugzilla.novell.com/show_bug.cgi?id=515570 but adding this in case
+                    string chromeFileString = string.Empty;
+                    bool foundPath = false;
+                    foreach (string path in chromePaths)
+                    {
+                        FileInfo binary = new FileInfo(path);
+                        if (binary.Exists)
+                        {
+                            chromeFileString = binary.FullName;
+                            foundPath = true;
+                            break;
+                        }
+                    }
+
+                    if (!foundPath)
+                    {
+                        throw new WebDriverException("Couldn't locate Chrome. Set webdriver.chrome.bin");
+                    }
+
+                    chromeFile = chromeFileString;
                 }
                 else
                 {
-                    throw new WebDriverException("Unsupported operating system.  " +
-                        "Could not locate Chrome.  Set webdriver.chrome.bin");
+                    throw new WebDriverException("Unsupported operating system. Could not locate Chrome.  Set webdriver.chrome.bin");
                 }
             }


Inverted logic

Inverted logic

--- src/Cash-Flow-Projection/Models/Dashboard.cs
+++ src/Cash-Flow-Projection/Models/Dashboard.cs
@@ -39,11 +39,11 @@
                     switch(entry.Account)
                     {
                         case Account.Cash:
-                            cash -= entry.Amount;
+                            cash += entry.Amount;
                             break;

                         case Account.Credit:
-                            credit -= entry.Amount;
+                            credit += entry.Amount;
                             break;
                     }


Fix Repositories always fail to copy.

Fix Repositories always fail to copy.

--- cli/src/MsgPack/Serialization/TypeKeyRepository.cs
+++ cli/src/MsgPack/Serialization/TypeKeyRepository.cs
@@ -43,7 +43,7 @@
 		public TypeKeyRepository( TypeKeyRepository copiedFrom )
 		{
 			this._lock = new ReaderWriterLockSlim( LockRecursionPolicy.NoRecursion );
-			if ( copiedFrom != null )
+			if ( copiedFrom == null )
 			{
 				this._table = new Dictionary<RuntimeTypeHandle, object>();
 			}


Fixing special case in IsMutable(...)

Fixing special case in IsMutable(...)

--- src/CommandLine/Core/ReflectionExtensions.cs
+++ src/CommandLine/Core/ReflectionExtensions.cs
@@ -115,9 +115,12 @@

         public static bool IsMutable(this Type type)
         {
-            var props = type.GetProperties(BindingFlags.Public | BindingFlags.Instance).Any(p => p.CanWrite);
-            var fields = type.GetFields(BindingFlags.Public | BindingFlags.Instance).Any();
-            return props || fields;
+            Func<bool> isMutable = () => {
+                var props = type.GetProperties(BindingFlags.Public | BindingFlags.Instance).Any(p => p.CanWrite);
+                var fields = type.GetFields(BindingFlags.Public | BindingFlags.Instance).Any();
+                return props || fields;
+            };
+            return type != typeof(object) ? isMutable() : true;
         }

         public static object CreateDefaultForImmutable(this Type type)


[AMViralSwitch] Podfile changes to fix build.

--- iOS/AMViralSwitch/build.cake
+++ iOS/AMViralSwitch/build.cake
@@ -2,6 +2,14 @@
 #load "../../common.cake"

 var TARGET = Argument ("t", Argument ("target", "Default"));
+
+var IOS_PODS = new List<string> {
+	"platform :ios, '7.0'",
+	"install! 'cocoapods', :integrate_targets => false",
+	"target 'Xamarin' do",
+	"pod 'AMViralSwitch', '1.0.0'",
+	"end",
+};

 var buildSpec = new BuildSpec () {
 	Libs = new ISolutionBuilder [] {
@@ -33,14 +41,16 @@

 Task ("externals").IsDependentOn ("externals-base").Does (() =>
 {
-	CreatePodfile ("./externals/", "ios", "7.0", new Dictionary<string, string> {
-        { "AMViralSwitch", "1.0.0" }
-	});
-	if (!FileExists ("./externals/Podfile.lock")) {
-		CocoaPodInstall ("./externals/", new CocoaPodInstallSettings { NoIntegrate = true });
-	}
+	EnsureDirectoryExists ("./externals");

-	BuildXCodeFatLibrary ("Pods/Pods.xcodeproj", "AMViralSwitch", null, null, null);
+	if (CocoaPodVersion () < new System.Version (1, 0))
+		IOS_PODS.RemoveAt (1);
+
+	FileWriteLines ("./externals/Podfile", IOS_PODS.ToArray ());
+
+	CocoaPodInstall ("./externals", new CocoaPodInstallSettings { NoIntegrate = true });
+
+	BuildXCodeFatLibrary ("./Pods/Pods.xcodeproj", "AMViralSwitch", "AMViralSwitch", null, null, "AMViralSwitch");
 });

 Task ("clean").IsDependentOn ("clean-base").Does (() =>


Remove extra space in PipeInvocation log message

--- src/Abc.Zebus/Scan/Pipes/PipeInvocation.cs
+++ src/Abc.Zebus/Scan/Pipes/PipeInvocation.cs
@@ -106,7 +106,7 @@
             if (_pipeStates == null)
                 _pipeStates = BeforeInvoke();

-            _messageLogger.DebugFormat("HANDLE : {0} [{1}]", _message, _messageContext.MessageId);
+            _messageLogger.DebugFormat("HANDLE: {0} [{1}]", _message, _messageContext.MessageId);

             return MessageContext.SetCurrent(_messageContext);
         }
@@ -116,7 +116,7 @@
             if (_pipeStates == null)
                 _pipeStates = BeforeInvoke();

-            _messageLogger.DebugFormat("HANDLE : {0} [{1}]", _message, _messageContext.MessageId);
+            _messageLogger.DebugFormat("HANDLE: {0} [{1}]", _message, _messageContext.MessageId);

             ApplyMutations(messageHandler);


ignore STDERR from tf.exe when query workspaces. (#1642)

--- src/Agent.Worker/Build/TFCommandManager.cs
+++ src/Agent.Worker/Build/TFCommandManager.cs
@@ -289,7 +289,8 @@
             args.Add("/format:xml");

             // Run the command.
-            string xml = await RunPorcelainCommandAsync(args.ToArray()) ?? string.Empty;
+            // Ignore STDERR from TF.exe, tf.exe use STDERR to report warning.
+            string xml = await RunPorcelainCommandAsync(true, args.ToArray()) ?? string.Empty;

             // Deserialize the XML.
             var serializer = new XmlSerializer(typeof(TFWorkspaces));


Edit layout update

Edit layout update

--- src/DotNetBlog/Pages/Blog/Manage/Edit.cshtml
+++ src/DotNetBlog/Pages/Blog/Manage/Edit.cshtml
@@ -7,14 +7,14 @@

     <form method="post" autocomplete="off" novalidate="novalidate">

-

-
-            <input asp-for="Input.Title" class="form-control" />
-
+

+
+            <input asp-for="Input.Title" class="form-control" style="align-items:stretch;" />
+

-

+

-
+                @**@

                     @if (this.Model.Input.PostID.HasValue && this.Model.Input.PostID.Value != Guid.Empty)
                     {
@@ -22,31 +22,24 @@
                     }
                     else
                     {
-

-                            <button class="btn btn-default dropdown-toggle" type="button"
-                                    id="editorOptions" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
-                                @this.Model.Input.EditorType
-
-                            </button>
-

-                                @foreach (var item in Enum.GetNames(typeof(EditorType)))
+

+                            @foreach (var item in Enum.GetNames(typeof(EditorType)))
+                            {
+                                @*@if (this.Model.Input.EditorType.ToString() != item)*@
                                 {
-                                    @if (this.Model.Input.EditorType.ToString() != item)
-                                    {
-
@item

-                                    }
+                                    @item
                                 }
-

+                            }

                     }

-            @if (this.Model.Input.EditorType == EditorType.Html)
-            {
-

-            }
-            <textarea asp-for="Input.Content" rows="20" class="form-control"></textarea>
-
+            @*@if (this.Model.Input.EditorType == EditorType.Html)
+                {
+

+                }*@
+            <textarea id="textEditor" asp-for="Input.Content" rows="20" class="form-control" style="align-items:stretch;"></textarea>
+

             <input type="hidden" asp-for="Input.PostID" />
@@ -67,15 +60,21 @@
             </style>
             break;
         case EditorType.Html:
+
+            <link rel="stylesheet" href="~/lib/codemirror/codemirror.css">
             break;
         case EditorType.Markdown:
             @*<link rel="stylesheet" href="~/thinker-md/stylesheets/thinker-md.vendor.css" asp-append-version="true" />
-            <link rel="stylesheet" href="~/thinker-md/emoji/nature.css" asp-append-version="true" />
-            <link rel="stylesheet" href="~/thinker-md/emoji/object.css" asp-append-version="true" />
-            <link rel="stylesheet" href="~/thinker-md/emoji/people.css" asp-append-version="true" />
-            <link rel="stylesheet" href="~/thinker-md/emoji/place.css" asp-append-version="true" />
-            <link rel="stylesheet" href="~/thinker-md/emoji/Sysmbols.css" asp-append-version="true" />
-            <link rel="stylesheet" href="~/thinker-md/emoji/twemoji.css" asp-append-version="true" />*@
+                <link rel="stylesheet" href="~/thinker-md/emoji/nature.css" asp-append-version="true" />
+                <link rel="stylesheet" href="~/thinker-md/emoji/object.css" asp-append-version="true" />
+                <link rel="stylesheet" href="~/thinker-md/emoji/people.css" asp-append-version="true" />
+                <link rel="stylesheet" href="~/thinker-md/emoji/place.css" asp-append-version="true" />
+                <link rel="stylesheet" href="~/thinker-md/emoji/Sysmbols.css" asp-append-version="true" />
+                <link rel="stylesheet" href="~/thinker-md/emoji/twemoji.css" asp-append-version="true" />*@


Paivitetty tehtavakuvauksia.

Paivitetty tehtavakuvauksia.

--- ForLoopTahti/ForLoopTahti/Program.cs
+++ ForLoopTahti/ForLoopTahti/Program.cs
@@ -14,71 +14,71 @@
             // ENSIMMAINEN OSA ======================
             // ======================================

-            // Luo funktio, joka koristelee sille parametrina annetun
-            // merkkijonon. Koristerivi-funktio koristelee merkkijonon
+            //Luo funktio, joka koristelee sille parametrina annetun
+            // merkkijonon.Koristerivi - funktio koristelee merkkijonon
             // lisäämällä sen alkuun ja loppuun tähtiä 8 kappaletta.
             // Koristerivi("TURO");

-            // Parantele Koristerivi-funktiota siten, että se huomioi nimen
-            // pituuden. Voidaan olettaa, että merkkijonon kokonaispituus
+            //Parantele Koristerivi-funktiota siten, että se huomioi nimen
+            // pituuden.Voidaan olettaa, että merkkijonon kokonaispituus
             // kun mukaan luetaan tähdet ja nimi, on enintään 30 merkkiä.
-            //
-            // Tehtävässä ei tarvitse huomioida parittomia lukuja, joten
+
+            // Tehtävässä ei tarvitse huomioida parittomia lukuja, joten
             // jos nimessä on pariton määrä kirjaimia, voi tuloste olla 29
             // tai 31 merkkiä.
             // Koristerivi("TURO");
-            // Koristerivi("SALMINEN");
-            // Koristerivi("AB");
-
-            // Parantele Koristerivi -funktiota siten, että voit määrittää
-            // nimen lisäksi rivin pituuden.
-            // Koristerivi("TURO", 30);
-
-            // Parantele Koristerivi-funktiota siten, että voit määrittää
-            // edellisten parametrien lisäksi tulostettavan merkin.
+            //Koristerivi("SALMINEN");
+            //Koristerivi("AB");
+
+            //Parantele Koristerivi -funktiota siten, että voit määrittää
+            //nimen lisäksi rivin pituuden.
+            //Koristerivi("TURO", 30);
+
+            //Parantele Koristerivi-funktiota siten, että voit määrittää
+            //edellisten parametrien lisäksi tulostettavan merkin.
             // Koristerivi("TURO", 30, "=");

             // ======================================
             // TOINEN OSA ===========================
             // ======================================

-            // Luo funktio, joka tulostaa nimen päälle ja alle 3 riviä
-            // tähtiä. Voit hyödyntää edellisessä tehtävässä syntynyttä
-            // funktiota kun tulostat nimeä. Huomaa, että tähtien määrä
-            // riveillä pitää olla sama kuin edellisessä tehtävässä eli
-            // 30 merkkiä.
-            //
-            // Tehtävässä ei tarvitse huomioida tilannetta, jossa nimessä
-            // on pariton määrä merkkejä. Voidaan olettaa, että tulostetuissa
-            // riveissä on aina 30 merkkiä nimen tulosteesta huolimatta.
-            // KoristeNelio("TURO");
+            // Luo funktio, joka tulostaa nimen päälle ja alle 3 riviä
+            //  tähtiä.Voit hyödyntää edellisessä tehtävässä syntynyttä
+            // funktiota kun tulostat nimeä.Huomaa, että tähtien määrä
+            //riveillä pitää olla sama kuin edellisessä tehtävässä eli
+            //  30 merkkiä.
+
+            //  Tehtävässä ei tarvitse huomioida tilannetta, jossa nimessä
+            //  on pariton määrä merkkejä. Voidaan olettaa, että tulostetuissa
+            //  riveissä on aina 30 merkkiä nimen tulosteesta huolimatta.
+            //  KoristeNelio("TURO");

             // Paranna edellistä funktiota siten, että voit nimen lisäksi
             // määrittää tulostettavien rivien ja rivin pituuden määrän.
-            // KoristeNelio("TURO", 3, 20);
+            //  KoristeNelio("TURO", 3, 20);

             // Paranna edellistä funktiota siten, että voit antaa parametrina
-            // tulostettavan merkin. Tarvittaessa voit hyödyntää harjoituksessa
-            // luotuja funktioita. Muuta tällöin funktioiden toteutuksia sellaiseksi,
-            // että ne vastaavat uutta toimeksiantoa.
-            // KoristeNelio("TÄHTI NELIÖ", 4, 40, "=");
+            // tulostettavan merkin.Tarvittaessa voit hyödyntää harjoituksessa
+            //  luotuja funktioita. Muuta tällöin funktioiden toteutuksia sellaiseksi,
+            //  että ne vastaavat uutta toimeksiantoa.
+            //  KoristeNelio("TÄHTI NELIÖ", 4, 40, "=");

             // ======================================
             // KOLMAS OSA ===========================
             // ======================================

-            // Olet tähän mennessä tehnyt funktion tulostamaan Koristerivin ja
+            //Olet tähän mennessä tehnyt funktion tulostamaan Koristerivin ja
             // koriste neliön. Nyt sovella osaamistasti ja toteuta samalla tapaa
-            // KoristeKolmio. Funktio tulostaa kyljellään olevan kolmion. Voidaan
-            // olettaa, että kolmion kärjen pituus on 10 merkkiä sen pohjasta.
-            //
-            // Harjoituksessa riittää, että tulostat vain kolmion. Käyttäjän pitää
+            // KoristeKolmio.Funktio tulostaa kyljellään olevan kolmion.Voidaan
+            //olettaa, että kolmion kärjen pituus on 10 merkkiä sen pohjasta.
+
+            //Harjoituksessa riittää, että tulostat vain kolmion.Käyttäjän pitää
             // pystyä määrittämään tulostettava merkki funktioon annettavana
-            // parametrinä. Nimeä ei tässä harjoituksessa ole pakko tulostaa.
-            //
-            // Esimerkkituloste (kolmion kärki -tekstiä ei tarvitse tulostaa,
-            // se on vain huomio):
-            //
+            // parametrinä.Nimeä ei tässä harjoituksessa ole pakko tulostaa.
+
+            //Esimerkkituloste(kolmion kärki - tekstiä ei tarvitse tulostaa,
+            //se on vain huomio):
+
             // *
             // **
             // ***
@@ -86,7 +86,7 @@
             // *****
             // ******
             // *******
-            // ******** (Kolmion kärki)
+            // ********(Kolmion kärki)
             // *******
             // ******
             // *****
@@ -96,11 +96,11 @@
             // *
             //KoristeKolmio("=");

-            // Parantele KoristeKolmio-funktiota siten, että voit antaa tulostettavien
+            //Parantele KoristeKolmio-funktiota siten, että voit antaa tulostettavien
             // merkkien lisäksi pituuden kolmion kärkeä varten. Kolmion kärjellä tässä
             // tarkoitetaan kolmion riviä, jossa on kokonaisuudessaan annettu määrä
             // merkkejä.
-            KoristeKolmio("=", 20);
+            //KoristeKolmio("=", 20);

         }


handle borky table names

handle borky table names

--- src/AppHarbor.SqlServerBulkCopy/Program.cs
+++ src/AppHarbor.SqlServerBulkCopy/Program.cs
@@ -110,7 +110,7 @@

 					using (var bulkCopy = new SqlBulkCopy(destinationConnectionString))
 					{
-						bulkCopy.DestinationTableName = table.Name;
+						bulkCopy.DestinationTableName = string.Format("[{0}]", table);
 						bulkCopy.BatchSize = 10000;
 						bulkCopy.BulkCopyTimeout = int.MaxValue;
 						bulkCopy.WriteToServer(reader);


Refactoring the duplicated logic

Refactoring the duplicated logic

Each handler type is pretty minimized now, and are able to focus on the
stuff they care about--parameter counts and types, without having to
rejection-check for nulls and multiple handlers.

--- src/ArguMint/ArguMint/HandlerDispatcher.cs
+++ src/ArguMint/ArguMint/HandlerDispatcher.cs
@@ -11,7 +11,7 @@
          _typeInspector = typeInspector;
       }

-      public void DispatchForAttribute<T>( object argumentClass ) where T : Attribute
+      private IMarkedMethod<T>[] GetMarkedMethods<T>( object argumentClass ) where T : Attribute
       {
          if ( argumentClass == null )
          {
@@ -20,53 +20,39 @@

          var markedMethods = _typeInspector.GetMarkedMethods<T>( argumentClass.GetType() );

-         if ( markedMethods != null )
+         if ( markedMethods?.Length > 1 )
          {
-            int count = markedMethods.Length;
+            throw new ArgumentConfigurationException( $"Argument class can only have one {typeof( T ).Name} but found {markedMethods.Length}" );
+         }

-            if ( count == 1 )
+         return markedMethods;
+      }
+
+      public void DispatchArgumentsOmitted( object argumentClass )
+      {
+         var markedMethods = GetMarkedMethods<ArgumentsOmittedHandlerAttribute>( argumentClass );
+
+         if ( markedMethods?.Length == 1 )
+         {
+            markedMethods[0].Invoke( argumentClass );
+         }
+      }
+
+      public void DispatchArgumentError( object argumentClass, ArgumentErrorType errorType )
+      {
+         var markedMethods = GetMarkedMethods<ArgumentErrorHandlerAttribute>( argumentClass );
+
+         if ( markedMethods?.Length == 1 )
+         {
+            var parameterTypes = markedMethods[0].ParameterTypes;
+
+            if ( parameterTypes.Length == 0 )
             {
                markedMethods[0].Invoke( argumentClass );
             }
-            else if ( count > 1 )
+            else if ( parameterTypes.Length == 1 && parameterTypes[0] == typeof( ArgumentErrorType ) )
             {
-               throw new ArgumentConfigurationException( $"Argument class can only have one {typeof( T ).Name} but found {count}" );
-            }
-         }
-      }
-
-      public void DispatchArgumentsOmitted( object argumentClass )
-         => DispatchForAttribute<ArgumentsOmittedHandlerAttribute>( argumentClass );
-
-      public void DispatchArgumentError( object argumentClass, ArgumentErrorType errorType )
-      {
-         if ( argumentClass == null )
-         {
-            throw new ArgumentException( "Argument class must not be null" );
-         }
-
-         var markedMethods = _typeInspector.GetMarkedMethods<ArgumentErrorHandlerAttribute>( argumentClass.GetType() );
-
-         if ( markedMethods != null )
-         {
-            int count = markedMethods.Length;
-
-            if ( count == 1 )
-            {
-               var parameterTypes = markedMethods[0].ParameterTypes;
-
-               if ( parameterTypes.Length == 0 )
-               {
-                  markedMethods[0].Invoke( argumentClass );
-               }
-               else if ( parameterTypes.Length == 1 && parameterTypes[0] == typeof( ArgumentErrorType ) )
-               {
-                  markedMethods[0].Invoke( argumentClass, new object[] { errorType } );
-               }
-            }
-            else if ( count > 1 )
-            {
-               throw new ArgumentConfigurationException( $"Argument class can only have one {typeof( ArgumentErrorHandlerAttribute ).Name} but found {count}" );
+               markedMethods[0].Invoke( argumentClass, new object[] { errorType } );
             }
          }
       }


Sample Test 31 - bug fixed (firefox)

Sample Test 31 - bug fixed (firefox)

--- src/DotVVM.Samples.Tests/BasicSamplesTest.cs
+++ src/DotVVM.Samples.Tests/BasicSamplesTest.cs
@@ -943,26 +943,33 @@
                 browser.NavigateToUrl(BaseUrl + "Sample31");

                 // select second option from combobox
-                browser.FindAll("select")[0].Click();
-                browser.FindAll("select")[0].FindAll("option")[0].Click();
+                browser.Find("select").Click();
+                Assert.IsNotNull(browser.Find("select").Find("option"));
+                browser.Find("h1").Click();
+
                 Thread.Sleep(WaitTime);

                 Assert.AreEqual("1", browser.GetText("span"));

                 // select second option from combobox
-                browser.FindAll("select")[0].Select(1);
+                browser.Find("select").Select(1);
+                browser.Find("h1").Click();
                 Thread.Sleep(WaitTime);

                 Assert.AreEqual("2", browser.GetText("span"));

                 // select third option from combobox
-                browser.FindAll("select")[0].Select(2);
+                browser.Find("select").Select(2);
+                browser.Find("h1").Click();
+
                 Thread.Sleep(WaitTime);

                 Assert.AreEqual("3", browser.GetText("span"));

                 // select fourth option from combobox
-                browser.FindAll("select")[0].Select(3);
+                browser.Find("select").Select(3);
+                browser.Find("h1").Click();
+
                 Thread.Sleep(WaitTime);

                 Assert.AreEqual("4", browser.GetText("span"));


Fixed download of large files

Fixed download of large files

--- src/DropboxRestAPI/Services/Core/Metadata.cs
+++ src/DropboxRestAPI/Services/Core/Metadata.cs
@@ -79,23 +79,28 @@

                 long? read = 0;
+                bool hasMore = true;
                 do
                 {
                     long? from = read;
                     long? to = read + _options.ChunkSize;
                     if (to > length)
                         to = length;
+                    if (from >= length)
+                        break;

                     using (var restResponse2 = await  _requestExecuter.Execute(() => _requestGenerator.FilesRange(_options.Root, path, from.Value, to.Value - 1, etag, rev, asTeamMember)).ConfigureAwait(false))
                     {
                         await restResponse2.Content.CopyToAsync(targetStream).ConfigureAwait(false);

                         read += restResponse2.Content.Headers.ContentLength;
+
+                        if (read >= length)
+                            hasMore = false;
+                        else if (restResponse2.StatusCode == HttpStatusCode.OK)
+                            hasMore = false;
                     }
-
-                    if (read >= length)
-                        break;
-                } while (restResponse.StatusCode == HttpStatusCode.PartialContent);
+                } while (hasMore);

             }
             return fileMetadata;


Fix DataGrid selection broken after 3 right clicks

--- src/Avalonia.Controls.DataGrid/DataGrid.cs
+++ src/Avalonia.Controls.DataGrid/DataGrid.cs
@@ -5751,6 +5751,7 @@
                 return true;
             }
             // Unselect everything except the row that was clicked on
+            _noSelectionChangeCount++;
             try
             {
                 UpdateSelectionAndCurrency(columnIndex, slot, DataGridSelectionAction.SelectCurrent, scrollIntoView: false);


Fix LibreOffice export on Linux (BL-2276)

--- src/BloomExe/CollectionTab/LibraryModel.cs
+++ src/BloomExe/CollectionTab/LibraryModel.cs
@@ -207,7 +207,11 @@
 		/// <summary>
 		/// All we do at this point is make a file with a ".doc" extension and open it.
 		/// </summary>
-		/// <param name="path"></param>
+		/// <remarks>
+		/// The .doc extension allows the operating system to recognize which program
+		/// should open the file, and the program (whether Microsoft Word or LibreOffice
+		/// or OpenOffice) seems to handle HTML content just fine.
+		/// </remarks>
 		public void ExportDocFormat(string path)
 		{
 			string sourcePath = _bookSelection.CurrentSelection.GetPathHtmlFile();
@@ -215,7 +219,15 @@
 			{
 				File.Delete(path);
 			}
-			File.Copy(sourcePath, path);
+			// Linux (Trusty) LibreOffice requires slightly different metadata at the beginning
+			// of the file in order to recognize it as HTML.  Otherwise it opens the file as raw
+			// HTML (See https://silbloom.myjetbrains.com/youtrack/issue/BL-2276 if you don't
+			// believe me.)  I don't know any perfect way to add this information to the file,
+			// but a simple string replace should be safe.  This change works okay for both
+			// Windows and Linux and for all three programs (Word, OpenOffice and Libre Office).
+			string content = File.ReadAllText(sourcePath);
+			string fixedContent = content.Replace("<meta charset=\"UTF-8\">", "<meta http-equiv=\"content-type\" content=\"text/html; charset=utf-8\">");
+			File.WriteAllText(path, fixedContent);
 		}

 		public void UpdateThumbnailAsync(Book.Book book, HtmlThumbNailer.ThumbnailOptions thumbnailOptions, Action<Book.BookInfo, Image> callback, Action<Book.BookInfo, Exception> errorCallback)


(maint) log that license file has been found

--- src/chocolatey/infrastructure/licensing/LicenseValidation.cs
+++ src/chocolatey/infrastructure/licensing/LicenseValidation.cs
@@ -40,6 +40,7 @@
             //no IFileSystem at this point
             if (File.Exists(licenseFile))
             {
+                "chocolatey".Log().Debug("Evaluating license file found at '{0}'".format_with(licenseFile));
                 var license = new LicenseValidator(PUBLIC_KEY, licenseFile);

                 try


Use common XulRunner initialization code from Browser.cs

--- src/BloomExe/Publish/ConversionProgress.cs
+++ src/BloomExe/Publish/ConversionProgress.cs
@@ -8,6 +8,7 @@
 using Gecko;
 using Palaso.IO;
 using Palaso.Reporting;
+using Bloom;

 namespace GeckofxHtmlToPdf
 {
@@ -30,55 +31,7 @@
 				this.ShowInTaskbar = false;
 			}

-			var xulRunnerPath = GetXulRunnerPath();
-			_pdfMaker.Initialize(xulRunnerPath);
-		}
-
-		// Todo: common code in Browser.cs
-		string GetXulRunnerPath()
-		{
-			string xulRunnerPath = Environment.GetEnvironmentVariable("XULRUNNER");
-			if (!Directory.Exists(xulRunnerPath))
-			{
-				xulRunnerPath = Path.Combine(FileLocator.DirectoryOfApplicationOrSolution, "xulrunner");
-				if (!Directory.Exists(xulRunnerPath))
-				{
-					//if this is a programmer, go look in the lib directory
-					xulRunnerPath = Path.Combine(FileLocator.DirectoryOfApplicationOrSolution,
-						Path.Combine("lib", "xulrunner"));
-
-					//on my build machine, I really like to have the dir labelled with the version.
-					//but it's a hassle to update all the other parts (installer, build machine) with this number,
-					//so we only use it if we don't find the unnumbered alternative.
-					if (!Directory.Exists(xulRunnerPath))
-					{
-						xulRunnerPath = Path.Combine(FileLocator.DirectoryOfApplicationOrSolution,
-							Path.Combine("lib", "xulrunner" + XulRunnerVersion));
-					}
-
-					if (!Directory.Exists(xulRunnerPath))
-					{
-						throw new ConfigurationException(
-							"Can't find the directory where xulrunner (version {0}) is installed",
-							XulRunnerVersion);
-					}
-				}
-			}
-			return xulRunnerPath;
-		}
-
-		private static int XulRunnerVersion
-		{
-			get
-			{
-				var geckofx = Assembly.GetAssembly(typeof(GeckoWebBrowser));
-				if (geckofx == null)
-					return 0;
-
-				var versionAttribute = geckofx.GetCustomAttributes(typeof(AssemblyFileVersionAttribute), true)
-					.FirstOrDefault() as AssemblyFileVersionAttribute;
-				return versionAttribute == null ? 0 : new Version(versionAttribute.Version).Major;
-			}
+			Browser.SetUpXulRunner();
 		}

 		private void ConversionProgress_Load(object sender, EventArgs e)


[Debug]Save message to "debug.log"

[Debug]Save message to "debug.log"

--- Grabacr07.KanColleViewer/App.xaml.cs
+++ Grabacr07.KanColleViewer/App.xaml.cs
@@ -31,6 +31,9 @@
 			base.OnStartup(e);

 			this.DispatcherUnhandledException += (sender, args) => ReportException(sender, args.Exception);
+#if DEBUG
+			Debug.Listeners.Add(new TextWriterTraceListener("debug.log"));
+#endif

 			DispatcherHelper.UIDispatcher = this.Dispatcher;
 			ProductInfo = new ProductInfo();


remove unused usings

remove unused usings

--- HDO2O.Models/ApplicationDbContext.cs
+++ HDO2O.Models/ApplicationDbContext.cs
@@ -1,9 +1,5 @@
 using Microsoft.AspNet.Identity.EntityFramework;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
+using System.Data.Entity;

 namespace HDO2O.Models
 {
@@ -18,5 +14,7 @@
         {
             return new ApplicationDbContext();
         }
+
+        //public DbSet<Test> Tests { get; set; }
     }
 }


Pool Privacy added to GroupsSearchResultCollection

--- src/Classes/GroupSearchResultCollection.cs
+++ src/Classes/GroupSearchResultCollection.cs
@@ -121,6 +121,11 @@
         public int TopicCount { get; set; }

         /// <summary>
+        /// The privacy setting on this group.
+        /// </summary>
+        public PoolPrivacy Privacy { get; set; }
+
+        /// <summary>
         /// The url for the group's icon.
         /// </summary>
         public string GroupIconUrl
@@ -163,6 +168,9 @@
                     case "topic_count":
                         TopicCount = reader.ReadContentAsInt();
                         break;
+                    case "privacy":
+                        Privacy = (PoolPrivacy) reader.ReadContentAsInt();
+                        break;
                     default:
                         UtilityMethods.CheckParsingException(reader);
                         break;
@@ -172,6 +180,7 @@
             reader.Skip();
         }

+
         #endregion
     }
 }


Cleaned up and extended Service Collection Extensions

--- src/Compose/ServiceCollectionExtensions.cs
+++ src/Compose/ServiceCollectionExtensions.cs
@@ -7,33 +7,27 @@
 {
 	public static class ServiceCollectionExtensions
 	{
+		public static IServiceCollection AddTransitional(this IServiceCollection services, Type serviceType, Type implementationType)
+			=> services.AddTransient(serviceType, implementationType).WithTransitional(serviceType);
+
 		public static IServiceCollection AddTransitional<TService, TImplementation>(this IServiceCollection services) where TImplementation : TService
-		{
-			return services
-				.AddTransient<TService, TImplementation>()
-				.WithTransitional<TService>();
-		}
+			=> services.AddTransient<TService, TImplementation>().WithTransitional<TService>();

 		public static IServiceCollection AsTransitional(this IServiceCollection services)
-		{
-			return services.AddTransient<TransitionMarker>();
-		}
+			=> services.AddTransient<TransitionMarker>();
+
+		public static IServiceCollection WithTransitional(this IServiceCollection services, Type serviceType)
+			=> services.AddTransient(typeof(TransitionMarker<>).MakeGenericType(new[] { serviceType }));

 		public static IServiceCollection WithTransitional<TService>(this IServiceCollection services)
-		{
-			return services.AddTransient<TransitionMarker<TService>>();
-		}
+			=> services.AddTransient<TransitionMarker<TService>>();

 		internal static SingletonRegister BuildSingletonRegister(this IServiceCollection services)
-		{
-			return new SingletonRegister(services);
-		}
+			=> new SingletonRegister(services);

 		internal static ServiceDescriptor BestSingletonMatchFor(this IServiceCollection services, Type serviceType)
-		{
-            return services.Where(x => x.Lifetime == ServiceLifetime.Singleton && serviceType.IsAssignableFrom(x.ServiceType))
+			=> services.Where(x => x.Lifetime == ServiceLifetime.Singleton && serviceType.IsAssignableFrom(x.ServiceType))
 				.OrderByDescending(x => x.ServiceType == serviceType)
 				.LastOrDefault();
-		}
 	}
 }


Reuse condition to check for directory existence.

--- src/Core/FSpot.FileSystem/GLibDirectory.cs
+++ src/Core/FSpot.FileSystem/GLibDirectory.cs
@@ -38,7 +38,7 @@
 		public bool Exists (SafeUri uri)
 		{
 			var directory = FileFactory.NewForUri (uri);
-			return directory.Exists && directory.QueryFileType (FileQueryInfoFlags.None, null) == FileType.Directory;
+			return ExistsAndIsDirectory (directory);
 		}

 		public void CreateDirectory (SafeUri uri)
@@ -57,7 +57,7 @@
 		public void Delete (SafeUri uri)
 		{
 			var directory = FileFactory.NewForUri (uri);
-			if (!directory.Exists || directory.QueryFileType (FileQueryInfoFlags.None, null) != FileType.Directory) {
+			if (!ExistsAndIsDirectory (directory)) {
 				//FIXME to be consistent with System.IO.Directory.Delete we should throw an exception in this case
 				return;
 			}
@@ -67,7 +67,7 @@
 		public IEnumerable<SafeUri> Enumerate (SafeUri uri)
 		{
 			var directory = FileFactory.NewForUri (uri);
-			if (!directory.Exists || directory.QueryFileType (FileQueryInfoFlags.None, null) != FileType.Directory) {
+			if (!ExistsAndIsDirectory (directory)) {
 				yield break;
 			}
 			using (var fileEnumerator = directory.EnumerateChildren ("standard::name", FileQueryInfoFlags.None, null)) {
@@ -77,5 +77,9 @@
 				}
 			}
 		}
+
+		bool ExistsAndIsDirectory (File directory) {
+			return directory.Exists && directory.QueryFileType (FileQueryInfoFlags.None, null) == FileType.Directory;
+		}
 	}
 }


I'm an idiot.  (Fix invalid SQL.)

I'm an idiot.  (Fix invalid SQL.)

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

--- src/DbLinq.Firebird/FirebirdSqlProvider.cs
+++ src/DbLinq.Firebird/FirebirdSqlProvider.cs
@@ -52,7 +52,7 @@

         protected override SqlStatement GetLiteralStringConcat(SqlStatement a, SqlStatement b)
         {
-            return SqlStatement.Format("{0} || {1})", a, b);
+            return SqlStatement.Format("{0} || {1}", a, b);
         }

         protected override char SafeNameStartQuote { get { return ' '; } }


CA writer: support writing null System.Types

--- src/DotNet/Writer/CustomAttributeWriter.cs
+++ src/DotNet/Writer/CustomAttributeWriter.cs
@@ -488,6 +488,8 @@
 						var ts = value.Value as TypeSig;
 						if (ts != null)
 							WriteType(ts);
+						else if (value.Value == null)
+							WriteUTF8String(null);
 						else {
 							helper.Error("Custom attribute value is not a type");
 							WriteUTF8String(UTF8String.Empty);


Add FixedTimeIsAllZeros function

Add FixedTimeIsAllZeros function

--- src/Experimental/CryptographicUtilities.cs
+++ src/Experimental/CryptographicUtilities.cs
@@ -29,6 +29,25 @@
             return System.Security.Cryptography.CryptographicOperations.FixedTimeEquals(left, right);
         }

+        [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
+        public static bool FixedTimeIsAllZeros(ReadOnlySpan<byte> data)
+        {
+            // NoOptimization because we want this method to be exactly as non-short-circuiting
+            // as written.
+            //
+            // NoInlining because the NoOptimization would get lost if the method got inlined.
+
+            int length = data.Length;
+            int accum = 0;
+
+            for (int i = 0; i < length; i++)
+            {
+                accum |= data[i];
+            }
+
+            return accum == 0;
+        }
+
         [MethodImpl(MethodImplOptions.AggressiveInlining)]
         public static byte[] HexDecode(string base16)
         {


Update to June 8, 2018

Update to June 8, 2018

--- src/FamilyTreeProject.GEDCOM/GEDCOMUtil.cs
+++ src/FamilyTreeProject.GEDCOM/GEDCOMUtil.cs
@@ -46,13 +46,18 @@
                 string prefix = idString.Substring(1, 1);
                 int? id = GetId(idString);

-                cleanId = CreateId(prefix, id);
+                cleanId = CreateId(prefix, id.Value);
             }

             return cleanId;
         }

-        public static string CreateId(string prefix, int? id)
+        public static string CreateId(string prefix, int id)
+        {
+            return String.Format("@{0}{1}@", prefix, id);
+        }
+
+        public static string CreateId(string prefix, string id)
         {
             return String.Format("@{0}{1}@", prefix, id);
         }


Delete KevinMarquette.cs

Delete KevinMarquette.cs

--- src/Firehose.Web/Authors/KevinMarquette.cs
+++ src/Firehose.Web/Authors/KevinMarquette.cs
@@ -1,25 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.ServiceModel.Syndication;
-using System.Web;
-using Firehose.Web.Infrastructure;
-
-namespace Firehose.Web.Authors
-{
-    public class KevinMarquette : IAmAMicrosoftMVP
-    {
-        public string FirstName => "Kevin";
-        public string LastName => "Marquette";
-        public string ShortBioOrTagLine => "Principal DevOps Engineer, Microsoft MVP, 2018 PowerShell Community Hero, and SoCal PowerShell UserGroup Organizer.";
-        public string StateOrRegion => "Irvine, CA, USA";
-        public string EmailAddress => "kevmar@gmail.com";
-        public string TwitterHandle => "kevinmarquette";
-        public string GitHubHandle => "kevinmarquette";
-        public string GravatarHash => "d7d29e9573b5da44d9886df24fcc6142";
-        public GeoPosition Position => new GeoPosition(33.6800000,-117.7900000);
-        public Uri WebSite => new Uri("https://PowerShellExplained.com");
-        public IEnumerable<Uri> FeedUris { get { yield return new Uri("https://powershellexplained.com/feed.xml"); } }
-        public string FeedLanguageCode => "en";
-    }
-}


When tests are skipped for a known reason, that reason is reported to TestDriven.NET.

--- src/Fixie.TestDriven/TestDrivenListener.cs
+++ src/Fixie.TestDriven/TestDrivenListener.cs
@@ -21,7 +21,8 @@
             tdnet.TestFinished(new TestResult
             {
                 Name = result.Name,
-                State = TestState.Ignored
+                State = TestState.Ignored,
+                Message = result.SkipReason
             });
         }


Trivial cleanup within ParameterDiscoverer.

--- src/Fixie/Discovery/ParameterDiscoverer.cs
+++ src/Fixie/Discovery/ParameterDiscoverer.cs
@@ -13,13 +13,12 @@
         public ParameterDiscoverer(Configuration config)
         {
             parameterSources = config.ParameterSourceTypes
-                .Select(customBehavior => (ParameterSource)Activator.CreateInstance((Type)customBehavior))
+                .Select(sourceType => (ParameterSource)Activator.CreateInstance(sourceType))
                 .ToArray();
         }

         public IEnumerable<object[]> GetParameters(MethodInfo method)
         {
-            //TODO: Shortcut when the method has no parameters anyway?
             return parameterSources.SelectMany(source => source.GetParameters(method));
         }
     }


Remove seeking streams in FolderFileStorage.

--- src/Foundatio/Storage/FolderFileStorage.cs
+++ src/Foundatio/Storage/FolderFileStorage.cs
@@ -88,9 +88,6 @@

             try {
                 using (var fileStream = CreateFileStream(file)) {
-                    if (stream.CanSeek)
-                        stream.Seek(0, SeekOrigin.Begin);
-
                     await stream.CopyToAsync(fileStream).AnyContext();
                     return true;
                 }


Fixed infinite loop in CheckAbiParameters.

--- src/Generator/Passes/CheckAbiParameters.cs
+++ src/Generator/Passes/CheckAbiParameters.cs
@@ -87,7 +87,7 @@
         {
             if (@class.Fields.Count > 0 || @class.IsDynamic)
                 return true;
-            return @class.Bases.Any(@base => @base.IsClass && HasFieldsOrVirtuals(@base.Class));
+            return @class.HasBaseClass && @class.Bases.Any(@base => @base.IsClass && HasFieldsOrVirtuals(@base.Class));
         }
     }
 }


#15 Ignores acknowledged projects.

#15 Ignores acknowledged projects.

--- HudsonTrayTracker/UI/TrayNotifier.cs
+++ HudsonTrayTracker/UI/TrayNotifier.cs
@@ -288,6 +288,11 @@
                 string prefix = null;
                 foreach (Project project in progressingAndErrorProjects)
                 {
+                    lock (acknowledgedStatusByProject)
+                    {
+                        if (acknowledgedStatusByProject.ContainsKey(project))
+                            continue;
+                    }
                     if (prefix != null)
                         tooltipText.Append(prefix);
                     BuildStatus status = GetProjectStatus(project);


[Hyena.Gui] Fix ActionManager toolitem icon sizing

Before, any custom widgets populated into a toolbar would not inherit
the size of the toolbar.  For example, in Banshee the Next button (a
MenuButton) would remain at size = LargeToolbar even if the toolbar size
had been set to Menu.  Fixes bgo#609265

--- Hyena.Gui/Hyena.Gui/ActionManager.cs
+++ Hyena.Gui/Hyena.Gui/ActionManager.cs
@@ -140,7 +140,25 @@
                 ToolItem container_item = new Hyena.Widgets.GenericToolItem<Widget> (item);
                 container_item.Expand = expand;
                 container_item.Show ();
+                container_item.ToolbarReconfigured += (o, a) => {
+                    SetItemSize (container_item, container_item.IconSize);
+                };
                 toolbar.Insert (container_item, position);
+            }
+        }
+
+        private void SetItemSize (Gtk.Widget widget, Gtk.IconSize size)
+        {
+            var container = widget as Container;
+            if (container != null) {
+                foreach (var child in container.Children) {
+                    SetItemSize (child, size);
+                }
+            }
+
+            var img = widget as Image;
+            if (img != null) {
+                img.IconSize = (int)size;
             }
         }


debug logger in release configuration enabled

--- src/ITCC.Logging.Core/Loggers/DebugLogger.cs
+++ src/ITCC.Logging.Core/Loggers/DebugLogger.cs
@@ -1,4 +1,6 @@
-// This is an open source non-commercial project. Dear PVS-Studio, please check it.
+#define DEBUG
+
+// This is an open source non-commercial project. Dear PVS-Studio, please check it.
 // PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
 using System.Diagnostics;
 using ITCC.Logging.Core.Interfaces;


Add inline methodimpl option to Require's class methods.

--- src/Journalist.LanguageExtensions/Require.cs
+++ src/Journalist.LanguageExtensions/Require.cs
@@ -1,11 +1,13 @@
 using System;
 using System.Diagnostics;
+using System.Runtime.CompilerServices;

 namespace Journalist
 {
     public static class Require
     {
         [DebuggerNonUserCode]
+        [MethodImpl(MethodImplOptions.AggressiveInlining)]
         public static void True(bool value, string param, string message)
         {
             if (value == false)
@@ -15,6 +17,7 @@
         }

         [DebuggerNonUserCode]
+        [MethodImpl(MethodImplOptions.AggressiveInlining)]
         public static void False(bool value, string param, string message)
         {
             if (value)
@@ -24,6 +27,7 @@
         }

         [DebuggerNonUserCode]
+        [MethodImpl(MethodImplOptions.AggressiveInlining)]
         public static void ZeroOrGreater(long value, string param)
         {
             if (value < 0)
@@ -33,6 +37,7 @@
         }

         [DebuggerNonUserCode]
+        [MethodImpl(MethodImplOptions.AggressiveInlining)]
         public static void Positive(long value, string param)
         {
             if (value <= 0)
@@ -42,6 +47,7 @@
         }

         [DebuggerNonUserCode]
+        [MethodImpl(MethodImplOptions.AggressiveInlining)]
         public static void NotNull(object value, string param)
         {
             if (value == null)
@@ -51,12 +57,14 @@
         }

         [DebuggerNonUserCode]
+        [MethodImpl(MethodImplOptions.AggressiveInlining)]
         public static void NotEmpty(string value, string param)
         {
             False(string.IsNullOrEmpty(value), param, "Value must be not empty.");
         }

         [DebuggerNonUserCode]
+        [MethodImpl(MethodImplOptions.AggressiveInlining)]
         public static void NotEmpty(Guid value, string param)
         {
             False(value == Guid.Empty, param, "Value must be not empty.");


Improve release stages when logging exceptions

--- src/LfMerge.Core/Logging/ExceptionLogging.cs
+++ src/LfMerge.Core/Logging/ExceptionLogging.cs
@@ -178,13 +178,19 @@

 			if (string.IsNullOrEmpty(Configuration.ReleaseStage))
 			{
-				var isDevelopment = Debugger.IsAttached;
-#if DEBUG
-				isDevelopment = true;
-#endif
-				if (isDevelopment)
+				var gitBranch = MainClass.GetVersionInfo("BranchName");
+
+				if (gitBranch.EndsWith("/live", StringComparison.InvariantCulture))
+					configuration.ReleaseStage = "live";
+				else if (gitBranch.EndsWith("/qa", StringComparison.InvariantCulture))
+					configuration.ReleaseStage = "qa";
+				else if (gitBranch.StartsWith("origin/", StringComparison.InvariantCulture))
 					configuration.ReleaseStage = "development";
-			}
+				else
+					configuration.ReleaseStage = "local";
+			}
+			configuration.NotifyReleaseStages = new[] { "live", "qa", "development" };
+

 			var metadata = new List<KeyValuePair<string, object>>();
 			if (configuration.GlobalMetadata != null)


fix width of post title closes #22

fix width of post title closes #22

--- src/MLSoftware.Web/Views/Post/Details.cshtml
+++ src/MLSoftware.Web/Views/Post/Details.cshtml
@@ -17,7 +17,7 @@

-

+

@Model.Title

             @if (!Model.IsDraft)
@@ -26,7 +26,7 @@
                     @Model.Published?.ToString("MMMM dd, yyyy hh:mm tt")

             }
-

+

                 @if (Model.Tags != null && Model.Tags.Any())
                 {


Allow external translations

Allow external translations

Add a new overload of `GetString` to DiagnosticInfo that accepts a ResourceManager instance that will be used to query for the error message description.

This allows translations or other error message customizations to be done in another resource file outside XmlParser.

--- src/Microsoft.Language.Xml/DiagnosticInfo.cs
+++ src/Microsoft.Language.Xml/DiagnosticInfo.cs
@@ -1,9 +1,10 @@
-using System;
+using System;
 using System.Collections.Generic;
 using System.Collections.Immutable;
 using System.Diagnostics;
 using System.Globalization;
-
+using System.Resources;
+
 namespace Microsoft.Language.Xml
 {
     /// <summary>
@@ -41,21 +42,23 @@
         public ERRID ErrorID { get; }
         public DiagnosticSeverity Severity => DiagnosticSeverity.Error;

-        public DiagnosticInfo (ERRID errID)
+        public DiagnosticInfo(ERRID errID)
         {
             ErrorID = errID;
         }

         public DiagnosticInfo(ERRID errID, object[] parameters)
-            : this (errID)
+            : this(errID)
         {
             this.parameters = parameters;
         }

-        public string GetDescription()
+        public string GetDescription() => GetDescription(XmlResources.ResourceManager);
+
+        public string GetDescription(ResourceManager resourceManager)
         {
             var name = ErrorID.ToString();
-            var description = XmlResources.ResourceManager.GetString(name);
+            var description = resourceManager.GetString(name);
             if (parameters != null)
                 description = string.Format(description, parameters);
             return description;


Fixed issue when the NSData is empty and doesn't have a memory address.

When NSData.Length == 0 its Bytes property points to 0x0 which is Null and causes issues in the UnmanagedMemoryStream that is returned from NSData.AsStream().

--- src/ModernHttpClient.iOS/AFNetworkHandler.cs
+++ src/ModernHttpClient.iOS/AFNetworkHandler.cs
@@ -60,9 +60,12 @@
                 lock (pins) { pins.Remove(rq); }
                 throw new TaskCanceledException();
             }
+
+            var respData = op.ResponseData;
+            var httpContent = new StreamContent (respData == null || respData.Length == 0 ? Stream.Null : respData.AsStream ());

             var ret = new HttpResponseMessage((HttpStatusCode)resp.StatusCode) {
-                Content = new StreamContent(respData.AsStream()),
+                Content = httpContent,
                 RequestMessage = request,
                 ReasonPhrase = (err != null ? err.LocalizedDescription : null),
             };


Add test for UnresolvedModule.ResolveAll.

--- src/Knapsack.UnitTests/UnresolvedModule.cs
+++ src/Knapsack.UnitTests/UnresolvedModule.cs
@@ -135,4 +135,30 @@
             module.Scripts[0].References.ShouldBeEmpty();
         }
     }
+
+    public class UnresolvedModule_ResolveAll
+    {
+        [Fact]
+        public void Returns_resolved_modules()
+        {
+            var moduleA = new UnresolvedModule("module-a", new[] { CreateScript("module-a", "foo") });
+            var moduleB = new UnresolvedModule("module-b", new[] { CreateScript("module-b", "bar", "../module-a/foo") });
+
+            var modules = UnresolvedModule.ResolveAll(new[] { moduleA, moduleB }).ToArray();
+
+            modules[0].Path.ShouldEqual("module-a");
+            modules[1].Path.ShouldEqual("module-b");
+            modules[1].References[0].ShouldEqual("module-a");
+        }
+
+
+        UnresolvedScript CreateScript(string module, string name, params string[] references)
+        {
+            return new UnresolvedScript(
+                module + "/" + name + ".js",
+                new byte[0],
+                references.Select(r => r + ".js").ToArray()
+            );
+        }
+    }
 }


That doesn't have to be awaited here.

That doesn't have to be awaited here.

--- src/MvvmNano.Forms/MvvmNanoFormsPresenter.cs
+++ src/MvvmNano.Forms/MvvmNanoFormsPresenter.cs
@@ -29,7 +29,7 @@
                 .ToArray();
         }

-        public async Task ShowViewModelAsync<TViewModel, TNavigationParameter>(TNavigationParameter parameter)
+        public Task ShowViewModelAsync<TViewModel, TNavigationParameter>(TNavigationParameter parameter)
         {
             Type viewModelType = typeof(TViewModel);

@@ -39,10 +39,10 @@
             IView view = CreateView(viewModelType);
             view.SetViewModel(viewModel);

-            await OpenPageAsync(view as Page);
+            return OpenPageAsync(view as Page);
         }

-        public async Task ShowViewModelAsync<TViewModel>()
+        public Task ShowViewModelAsync<TViewModel>()
         {
             Type viewModelType = typeof(TViewModel);

@@ -55,7 +55,7 @@
             IView view = CreateView(viewModelType);
             view.SetViewModel(viewModel);

-            await OpenPageAsync(view as Page);
+            return OpenPageAsync(view as Page);
         }

         private static IViewModel CreateViewModel<TViewModel>(Type viewModelType)


Fixing path access denied error on MMappedDir

--- src/Lucene.Net.Core/Store/MMapDirectory.cs
+++ src/Lucene.Net.Core/Store/MMapDirectory.cs
@@ -352,7 +352,7 @@
              */

             if (input.memoryMappedFile == null)
-                input.memoryMappedFile = MemoryMappedFile.CreateFromFile(fc, null, length == 0 ? 100 : length, MemoryMappedFileAccess.ReadWrite, null, HandleInheritability.None, false);
+                input.memoryMappedFile = MemoryMappedFile.CreateFromFile(fc, null, length == 0 ? 100 : length, MemoryMappedFileAccess.ReadWrite, null, HandleInheritability.Inheritable, false);

             long bufferStart = 0L;
             for (int bufNr = 0; bufNr < nrBuffers; bufNr++)


Bumped version to 2.0

Bumped version to 2.0

--- src/MIISHandler/Properties/AssemblyInfo.cs
+++ src/MIISHandler/Properties/AssemblyInfo.cs
@@ -10,7 +10,7 @@
 [assembly: AssemblyConfiguration("")]
 [assembly: AssemblyCompany("")]
 [assembly: AssemblyProduct("MIISHandler")]
-[assembly: AssemblyCopyright("Copyright © JM Alarcón  2017 - www.jasoft.org")]
+[assembly: AssemblyCopyright("JM Alarcón  2017-2018 - JMAlarcon - www.jasoft.org - Open Source")]
 [assembly: AssemblyTrademark("")]
 [assembly: AssemblyCulture("")]

@@ -31,5 +31,5 @@
 //
 // You can specify all the values or you can default the Revision and Build Numbers
 // by using the '*' as shown below:
-[assembly: AssemblyVersion("1.2.0")]
-[assembly: AssemblyFileVersion("1.2.0")]
+[assembly: AssemblyVersion("2.0.0")]
+[assembly: AssemblyFileVersion("2.0.0")]


Fixed a change in Crystal that prevented this from building. Planning to come back to this app when the redstone/anniversary sdk becomes usable.

--- src/Neptunium/ViewModel/AppShellViewModel.cs
+++ src/Neptunium/ViewModel/AppShellViewModel.cs
@@ -168,7 +168,7 @@
             BackgroundMediaPlayer.SendMessageToBackground(payload);
         }

-        protected override Task OnSuspendingAsync(object data)
+        protected override Task OnSuspendingAsync(IDictionary<string, object> data)
         {
             var payload = new ValueSet();
             payload.Add(Messages.AppSuspend, "");


Add a cachebusting parameter to CSS and JS requests.

Specifically, use asp-append-version="true" on the requests for the
minified CSS and JS to append a ?v=fingerprint parameter, as a
cachebuster when the content changes.

--- src/NodaTime.Web/Views/Shared/_Layout.cshtml
+++ src/NodaTime.Web/Views/Shared/_Layout.cshtml
@@ -20,7 +20,7 @@
 </environment>
 <environment names="Staging,Production">
     <link rel="stylesheet" href="/css/foundation.min.css" />
-    <link rel="stylesheet" href="/css/site.min.css">
+    <link rel="stylesheet" href="/css/site.min.css" asp-append-version="true">
 </environment>

     <script>
@@ -129,7 +129,7 @@
     <script src="/js/site.js"></script>
 </environment>
 <environment names="Staging,Production">
-    <script src="/js/site.min.js"></script>
+    <script src="/js/site.min.js" asp-append-version="true"></script>
 </environment>
 </body>
 </html>


small change

small change

--- JAMENDOwnloader/JamendoDownloader.cs
+++ JAMENDOwnloader/JamendoDownloader.cs
@@ -145,13 +145,17 @@
             }
             #endregion

-            #endregion
-
+            #region not enough parameters
             if (args.Length < 2)
             {
                 DisplayHelpText();
                 return;
             }
+            #endregion
+
+            #endregion
+
+

             #region Parse the XML
             Console.Write("Parsing XML Data...");


Default to 2 silos being started in the TestCluster. This is to spot serialization issues that don't occur in a 1 silo deployment that just does deep copying.

--- src/OrleansTestingHost/TestClusterOptions.cs
+++ src/OrleansTestingHost/TestClusterOptions.cs
@@ -32,7 +32,7 @@
             this.BaseGatewayPort = ThreadSafeRandom.Next(40000, 50000);
         }

-        public static short DefaultInitialSilosCount { get; set; } = 1;
+        public static short DefaultInitialSilosCount { get; set; } = 2;
         public static bool DefaultTraceToConsole { get; set; } = true;
         public static string DefaultLogsFolder { get; set; } = "logs";


stream_socket_server() correct signature

resolves https://github.com/peachpiecompiler/peachpie/issues/366

--- src/Peachpie.Library/Streams/StreamSocket.cs
+++ src/Peachpie.Library/Streams/StreamSocket.cs
@@ -217,17 +217,17 @@
         /// <summary>
         /// Open client socket.
         /// </summary>
-        public static PhpResource stream_socket_server(Context ctx, string localSocket, out int errno, out string errstr, double timeout = double.NaN, SocketOptions flags = SocketOptions.None)
+        public static PhpResource stream_socket_server(Context ctx, string localSocket, out int errno, out string errstr, SocketOptions flags = SocketOptions.None)
         {
             int port = 0;
             //SplitSocketAddressPort(ref localSocket, out port);
-            return Connect(ctx, localSocket, port, out errno, out errstr, timeout, flags, StreamContext.Default);
-        }
-
-        /// <summary>
-        /// Open client socket.
-        /// </summary>
-        public static PhpResource stream_socket_server(Context ctx, string localSocket, out int errno, out string errstr, double timeout, SocketOptions flags, PhpResource context)
+            return Connect(ctx, localSocket, port, out errno, out errstr, Double.NaN, flags, StreamContext.Default);
+        }
+
+        /// <summary>
+        /// Open client socket.
+        /// </summary>
+        public static PhpResource stream_socket_server(Context ctx, string localSocket, out int errno, out string errstr, SocketOptions flags, PhpResource context)
         {
             StreamContext sc = StreamContext.GetValid(context);
             if (sc == null)
@@ -239,7 +239,7 @@

             int port = 0;
             //SplitSocketAddressPort(ref localSocket, out port);
-            return Connect(ctx, localSocket, port, out errno, out errstr, timeout, flags, sc);
+            return Connect(ctx, localSocket, port, out errno, out errstr, Double.NaN, flags, sc);
         }

         #endregion


Removes RandomMilliseconds from Timestamp class

--- src/PushNotifications.Contracts/Timestamp.cs
+++ src/PushNotifications.Contracts/Timestamp.cs
@@ -31,14 +31,5 @@
         {
             return new Timestamp(DateTime.UtcNow.AddYears(100));
         }
-
-        public static Timestamp RandomMilliseconds(Timestamp source)
-        {
-            if (ReferenceEquals(null, source) == true) throw new ArgumentNullException(nameof(source));
-
-            var random = new Random();
-            var dateTime = source.DateTime.AddMilliseconds(random.Next(1, 100));
-            return new Timestamp(dateTime);
-        }
     }
 }


Added license information to file.

Added license information to file.

--- Kihon.Services.Tests/SetOnceTests.cs
+++ Kihon.Services.Tests/SetOnceTests.cs
@@ -1,13 +1,35 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using Kihon.Services;
-using NUnit.Framework;
-using Moq;
+// The MIT License (MIT)
+//
+// Copyright (c) 2014 mugenkanosei
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in all
+// copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+// SOFTWARE.

 namespace Kihon.Services.Tests
 {
+    using System;
+    using System.Collections.Generic;
+    using System.Linq;
+    using System.Text;
+    using Kihon.Services;
+    using NUnit.Framework;
+    using Moq;
+
     [TestFixture]
     class SetOnceTests
     {


estilo a btn modelo_delete

estilo a btn modelo_delete

--- LaTuerca/Views/Modelos/Delete.cshtml
+++ LaTuerca/Views/Modelos/Delete.cshtml
@@ -9,95 +9,84 @@
     ViewBag.Title = "Eliminar";
 }

+@if (TempData["notice"] != null)
+{
+

+

+               @TempData["notice"]
+

+

+}
+
+

+    @using (Html.BeginForm())
+    {
+        @Html.AntiForgeryToken()
+

+            <button type="submit" class="btn btn-primary btn-block btn hidden-lg tip" title="Eliminar">
+
+            </button>
+            <button type="submit" class="btn btn-danger btn btn-block visible-lg tip" title="Eliminar">
+                   ¿Está seguro de que desea eliminar permanentemente?
+            </button>
+

+    }
+

-        @if (!Html.ViewData.ModelState.IsValid)
-        {
-

-

-                    @Html.ValidationSummary()
+

+

+

+

+
+                        @ViewBag.NombreEmpresa
+                        @ViewBag.Title
+
+

+

+
+
+
+
+                             Ver Proveedores
+
+
+
+
+
+                             Nuevo Proveedor
+
+

+

+

+

+

+                                    @Html.DisplayNameFor(model => model.Marca.Nombre)
+

+
+

+                                    @Html.DisplayFor(model => model.Marca.Nombre)
+

+
+

+                                    @Html.DisplayNameFor(model => model.NombreModelo)
+

+
+

+                                    @Html.DisplayFor(model => model.NombreModelo)
+

+
+

+                                    @Html.DisplayNameFor(model => model.Estado)
+

+
+

+                                    @Html.DisplayFor(model => model.Estado)
+

+
+

+

+

-        }
-

-

-

-
Submenú

-

-                        <button class="btn btn-box-tool" data-widget="collapse"></button>
-

-

-

-

-

-
-                                 Nuevo
-
-

-

-
-                                 Ver todo
-
-

-

-
-                                 Modificar
-
-

-

-

-
-

-
-

-
-

-
-

-

-

-                         @ViewBag.Title
-

-

-

-

-

-                            @Html.DisplayNameFor(model => model.Marca.Nombre)
-

-
-

-                            @Html.DisplayFor(model => model.Marca.Nombre)
-

-
-

-                            @Html.DisplayNameFor(model => model.NombreModelo)
-

-
-

-                            @Html.DisplayFor(model => model.NombreModelo)
-

-
-

-                            @Html.DisplayNameFor(model => model.Estado)
-

-
-

-                            @Html.DisplayFor(model => model.Estado)
-

-
-

-
-

-

-                    @using (Html.BeginForm())
-                    {
-                        @Html.AntiForgeryToken()
-                        <button type="submit" class="btn btn-social btn-danger pull-right">
-                             Eliminar Modelo
-                        </button>
-                    }
-

-

-

-

-

+


travis-ci.org errors if no output in 10 minutes, so run for 5 minutes only

--- src/RunProcessAsTask.Tests/ProcessExTests.cs
+++ src/RunProcessAsTask.Tests/ProcessExTests.cs
@@ -60,23 +60,13 @@
             }

             [Fact]
-            public void RunLotsOfOutputForOneHour()
+            public void RunLotsOfOutputForFiveMinutes()
             {
-                // NOTE: we could get 'native' skip support here using https://www.nuget.org/packages/Xunit.SkippableFact/
-                // but it felt like overkill for this one-off case of just wanting to avoid a long-running CI test
-
-                // we can rely on travis-ci to set this environment variable
-                // see https://docs.travis-ci.com/user/environment-variables/#Default-Environment-Variables
-                if (Environment.GetEnvironmentVariable("CONTINUOUS_INTEGRATION") != "true")
-                {
-                    // only want to run this on our CI environment since it takes so long
-                    return;
-                }
-
-                // if it can run for an hour and not cause the output-truncation issue, we are probably fine
-                //for (int i = 0; i < 1000; i++)
-                var oneHour = TimeSpan.FromHours(1);
-                for (var stopwatch = Stopwatch.StartNew(); stopwatch.Elapsed < oneHour; )
+                // when this problem manifested with the older code, it would normally
+                // trigger in this test within 5 to 10 seconds, so if it can run for
+                // 5 minutes and not cause the output-truncation issue, we are probably fine
+                var fiveMinutes = TimeSpan.FromMinutes(5);
+                for (var stopwatch = Stopwatch.StartNew(); stopwatch.Elapsed < fiveMinutes; )
                 {
                     WhenProcessReturnsLotsOfOutput_AllOutputCapturedCorrectly();
                 }


Display span information for ScriptRuntimeException message. Previously only message was displayed.

--- src/Scriban/Syntax/ScriptRuntimeException.cs
+++ src/Scriban/Syntax/ScriptRuntimeException.cs
@@ -1,4 +1,4 @@
-// Copyright (c) Alexandre Mutel. All rights reserved.
+// Copyright (c) Alexandre Mutel. All rights reserved.
 // Licensed under the BSD-Clause 2 license.
 // See license.txt file in the project root for full license information.

@@ -11,17 +11,16 @@
 {
     public class ScriptRuntimeException : Exception
     {
-        public ScriptRuntimeException(SourceSpan span, string message) : base(message)
+        public ScriptRuntimeException(SourceSpan span, string message) : this(span, message, null)
+        {
+        }
+
+        public ScriptRuntimeException(SourceSpan span, string message, Exception innerException) : base(new LogMessage(ParserMessageType.Error, span, message).ToString(), innerException)
         {
             Span = span;
         }

-        public ScriptRuntimeException(SourceSpan span, string message, Exception innerException) : base(message, innerException)
-        {
-            Span = span;
-        }
-
-        public SourceSpan Span { get;  }
+        public SourceSpan Span { get; }

         public override string ToString()
         {


Refactor TryGetLocalDbApiPath()

Refactor TryGetLocalDbApiPath()

Refactor the TryGetLocalDbApiPath() method to reduce the complexity and leverage Version.TryParse().

--- src/SqlLocalDb/Interop/LocalDbInstanceApi.cs
+++ src/SqlLocalDb/Interop/LocalDbInstanceApi.cs
@@ -1,4 +1,4 @@
-// Copyright (c) Martin Costello, 2012-2018. All rights reserved.
+// Copyright (c) Martin Costello, 2012-2018. All rights reserved.
 // Licensed under the Apache 2.0 license. See the LICENSE file in the project root for full license information.

 using System;
@@ -442,14 +442,7 @@
         {
             fileName = null;

-            bool isWow64Process = Environment.Is64BitOperatingSystem && !Environment.Is64BitProcess;
-
-            // Open the appropriate Registry key if running as a 32-bit process on a 64-bit machine
-            string keyName = string.Format(
-                CultureInfo.InvariantCulture,
-                @"SOFTWARE\{0}Microsoft\Microsoft SQL Server Local DB\Installed Versions",
-                isWow64Process ? @"Wow6432Node\" : string.Empty);
-
+            string keyName = DeriveLocalDbRegistryKey();
             IRegistryKey key = Registry.OpenSubKey(keyName);

             if (key == null)
@@ -469,13 +462,7 @@

                 foreach (string versionString in key.GetSubKeyNames())
                 {
-                    Version version;
-
-                    try
-                    {
-                        version = new Version(versionString);
-                    }
-                    catch (Exception ex) when (ex is ArgumentException || ex is FormatException || ex is OverflowException)
+                    if (!Version.TryParse(versionString, out Version version))
                     {
                         Logger.InvalidRegistryKey(versionString);
                         continue;
@@ -532,6 +519,23 @@

             fileName = Path.GetFullPath(path);
             return true;
+        }
+
+        /// <summary>
+        /// Derives the name of the Windows registry key name to use to locate the SQL LocalDB Instance API.
+        /// </summary>
+        /// <returns>
+        /// The registry key name to use for the current process.
+        /// </returns>
+        private static string DeriveLocalDbRegistryKey()
+        {
+            // Open the appropriate Registry key if running as a 32-bit process on a 64-bit machine
+            bool isWow64Process = Environment.Is64BitOperatingSystem && !Environment.Is64BitProcess;
+
+            return string.Format(
+                CultureInfo.InvariantCulture,
+                @"SOFTWARE\{0}Microsoft\Microsoft SQL Server Local DB\Installed Versions",
+                isWow64Process ? @"Wow6432Node\" : string.Empty);
         }

         /// <summary>


poa miner emprovement (#3751)

poa miner emprovement (#3751)

--- src/Stratis.Bitcoin.Features.PoA/PoAMiner.cs
+++ src/Stratis.Bitcoin.Features.PoA/PoAMiner.cs
@@ -180,6 +180,8 @@

         private async Task<uint> WaitUntilMiningSlotAsync()
         {
+            uint? myTimestamp = null;
+
             while (!this.cancellation.IsCancellationRequested)
             {
                 uint timeNow = (uint)this.dateTimeProvider.GetAdjustedTimeAsUnixTimestamp();
@@ -190,23 +192,24 @@
                     continue;
                 }

-                uint myTimestamp;
-
-                try
-                {
-                    myTimestamp = this.slotsManager.GetMiningTimestamp(timeNow);
-                }
-                catch (NotAFederationMemberException)
-                {
-                    this.logger.LogWarning("This node is no longer a federation member!");
-
-                    throw new OperationCanceledException();
+                if (myTimestamp == null)
+                {
+                    try
+                    {
+                        myTimestamp = this.slotsManager.GetMiningTimestamp(timeNow);
+                    }
+                    catch (NotAFederationMemberException)
+                    {
+                        this.logger.LogWarning("This node is no longer a federation member!");
+
+                        throw new OperationCanceledException();
+                    }
                 }

                 int estimatedWaitingTime = (int)(myTimestamp - timeNow) - 1;

                 if (estimatedWaitingTime <= 0)
-                    return myTimestamp;
+                    return myTimestamp.Value;

                 await Task.Delay(TimeSpan.FromMilliseconds(500), this.cancellation.Token).ConfigureAwait(false);
             }


Remove Required attribute from EndTime.

Remove Required attribute from EndTime.

--- src/Tethr.AudioBroker/Model/RecordingInfo.cs
+++ src/Tethr.AudioBroker/Model/RecordingInfo.cs
@@ -69,7 +69,8 @@
 					_startTime = value.ToUniversalTime();
 				else
 				{
-					Debug.Assert(value.Kind == DateTimeKind.Utc, "Start time kind is Unspecified, this could result in incorrect times showing up in Tethr");
+					Debug.Assert(value.Kind == DateTimeKind.Utc,
+						"Start time kind is Unspecified, this could result in incorrect times showing up in Tethr");
 					_startTime = value;
 				}
 			}
@@ -78,7 +79,7 @@
 		/// <summary>
 		/// The end time of the call, this value should be in UTC.
 		/// </summary>
-		[JsonProperty(Required = Required.Always)]
+		[JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore, NullValueHandling = NullValueHandling.Ignore)]
 		public DateTime EndTime
 		{
 			get { return _endTime; }
@@ -88,7 +89,8 @@
 					_endTime = value.ToUniversalTime();
 				else
 				{
-					Debug.Assert(value.Kind == DateTimeKind.Utc, "End time kind is Unspecified, this could result in incorrect times showing up in Tethr");
+					Debug.Assert(value.Kind == DateTimeKind.Utc,
+						"End time kind is Unspecified, this could result in incorrect times showing up in Tethr");
 					_endTime = value;
 				}
 			}


Move all lets and consts to vars

Move all lets and consts to vars

--- src/WebApiToTypeScript/WebApiToTypeScript.cs
+++ src/WebApiToTypeScript/WebApiToTypeScript.cs
@@ -125,7 +125,7 @@

             var callBlock = classBlock
                 .AddAndUseBlock($"call = ({callArgumentsList}) =>")
-                .AddStatement("const httpService = angular.injector(['ng']).get<ng.IHttpService>('$http');")
+                .AddStatement("var httpService = angular.injector(['ng']).get<ng.IHttpService>('$http');")
                 .AddAndUseBlock("return httpService(", isFunctionBlock: true, terminateWithSemicolon: true)
                 .AddStatement($"method: '{verb.VerbMethod}',")
                 .AddStatement($"url: this.toString(){dataDelimiter}");
@@ -175,7 +175,7 @@

             var queryStringBlock = classBlock
                 .AddAndUseBlock("private getQueryString = (): string =>")
-                .AddStatement("let parameters: string[] = [];");
+                .AddStatement("var parameters: string[] = [];");

             foreach (var routePart in queryStringParameters)
             {
@@ -202,7 +202,7 @@
                 else
                 {
                     block
-                        .AddStatement($"let {argumentName}Params = this.{argumentName}.getQueryParams();")
+                        .AddStatement($"var {argumentName}Params = this.{argumentName}.getQueryParams();")
                         .AddAndUseBlock($"Object.keys({argumentName}Params).forEach((key) =>", isFunctionBlock: true, terminateWithSemicolon: true)
                         .AddAndUseBlock($"if ({argumentName}Params[key] != null)")
                         .AddStatement($"parameters.push(`${{key}}=${{encodeURIComponent({argumentName}Params[key].toString())}}`);");


Increase blaster firing interval.

Increase blaster firing interval.

--- ethernet/server/scripts/weapons/blaster/blaster.cs
+++ ethernet/server/scripts/weapons/blaster/blaster.cs
@@ -151,7 +151,7 @@
 		// fire!...
 		stateName[3]                     = "Fire";
 		stateTransitionOnTimeout[3]      = "AfterFire";
-		stateTimeoutValue[3]             = 0.10;
+		stateTimeoutValue[3]             = 0.20;
 		stateFire[3]                     = true;
 		stateFireProjectile[3]           = RedBlasterProjectile;
 		stateRecoil[3]                   = MediumRecoil;


Repository mappa búin til og SubPartRepository fluttur yfir í möppuna

--- verklegt/Models/SubPartsRepository.cs
+++ verklegt/Models/SubPartsRepository.cs
@@ -1,68 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Web;
-using verklegt.DAL;
-
-namespace verklegt.Models
-{
-	public class SubPartsRepository
-	{
-		//Connect to DB
-		//Get SubParts
-		//Update SubPart
-
-		// Búum til tilvik af  gagnagrunninum okkar til vinna með.
-		AppContext db = new AppContext();
-
-		// Fall sem sækir alla SubPartana okkar í gagnagrunninn og skilar þeim tilbaka.
-		public IEnumerable<SubPart> GetAllSubParts()
-		{
-			return db.SubParts;
-		}
-
-		// Fall sem sækir SubParta eftir Id-i hans eða null gildi ef hann er ekki til.
-		public SubPart GetSubPartById(int? id)
-		{
-			var result = (from s in db.SubParts
-						  where s.ID == id
-						  select s).SingleOrDefault();
-
-			return result;
-		}
-
-		// Fall sem uppfærir SubPart eftir Id-inu hans í gagnagrunninum og skilar
-		// þér í Index eða NotFound View ef engu er skilað til baka
-		public void UpdateSubPart(SubPart s)
-		{
-			SubPart sp = GetSubPartById(s.ID);
-
-
-			if (sp != null)
-			{
-				sp.StartTime = s.StartTime;
-				sp.EndTime = s.EndTime;
-				sp.MediaURLExtension = s.MediaURLExtension;
-				db.SaveChanges();
-			}
-		}
-
-		// Fall sem vistar SubPart í gagnagrunni.
-		public void SaveSubPart()
-		{
-			db.SaveChanges();
-		}
-
-		// Fall sem býr til SubPart í gagnagrunni.
-		public void AddSubPart(SubPart s)
-		{
-			db.SubParts.Add(s);
-		}
-
-		// Fall sem eyðir út SubPart í gagnagrunni.
-		public void RemoveSubPart (SubPart s)
-		{
-			db.SubParts.Remove(s);
-		}
-	}
-}


use DefaultPropertyNameInferrer from settings when resolving property names

--- src/Nest/Resolvers/PropertyNameResolver.cs
+++ src/Nest/Resolvers/PropertyNameResolver.cs
@@ -77,7 +77,7 @@
 				return null;

 			var name = info.Name;
-			var resolvedName = name.ToCamelCase();
+			var resolvedName = _settings.DefaultPropertyNameInferrer(name);
 			var att = ElasticAttributes.Property(info);
 			if (att != null && !att.Name.IsNullOrEmpty())
 				resolvedName = att.Name;


Add exception message when node cannot response for leader request.

--- src/Neutrino.Consensus/States/Candidate.cs
+++ src/Neutrino.Consensus/States/Candidate.cs
@@ -167,8 +167,9 @@

                 Task.WhenAll(tasks.ToArray()).GetAwaiter().GetResult();
             }
-            catch (Exception)
-            {
+            catch (Exception exception)
+            {
+                _logger.LogWarning($"Cannot connect to node. Exception type: '{exception.GetType()}'. Exception message: {exception.Message}.");
             }

             return tasks;


Optimization: Add default for max iterations for BFGS

--- src/Numerics/Optimization/BfgsMinimizer.cs
+++ src/Numerics/Optimization/BfgsMinimizer.cs
@@ -10,7 +10,7 @@
 		public double ParameterTolerance { get; set; }
         public int MaximumIterations { get; set; }

-        public BfgsMinimizer(double gradientTolerance, double parameterTolerance, int maximumIterations)
+        public BfgsMinimizer(double gradientTolerance, double parameterTolerance, int maximumIterations=1000)
         {
             GradientTolerance = gradientTolerance;
 			ParameterTolerance = parameterTolerance;


json_encode cleanup

json_encode cleanup

- few optimizations

--- src/Peachpie.Library/Serialization.Json.cs
+++ src/Peachpie.Library/Serialization.Json.cs
@@ -35,7 +35,7 @@
             #region Tokens

             /// <summary>
-            /// Contains definition of (one-character) tokens that constitute PHP serialized data.
+            /// Contains definition of tokens that constitute PHP serialized data.
             /// </summary>
             internal class Tokens
             {
@@ -49,6 +49,8 @@
                 internal const string PropertyKeyValueSeparatorString = ":";

                 internal const char Quote = '"';
+                internal const string QuoteString = "\""; // "
+                internal const string DoubleQuoteString = "\"\""; // ""
                 internal const char Escape = '\\';

                 internal const string EscapedNewLine = @"\n";
@@ -257,8 +259,6 @@
                 /// <summary>
                 /// Determines if given character should be encoded.
                 /// </summary>
-                /// <param name="c"></param>
-                /// <returns></returns>
                 private bool CharShouldBeEncoded(char c)
                 {
                     switch (c)
@@ -288,6 +288,21 @@
                         default:
                             return !CharIsPrintable(c);
                     }
+                }
+
+                /// <summary>
+                /// Determines if some chars in given string should be encoded.
+                /// </summary>
+                private bool StringShouldBeEncoded(string str)
+                {
+                    Debug.Assert(str != null);
+
+                    for (int i = 0; i < str.Length; i++)
+                    {
+                        if (CharShouldBeEncoded(str[i])) return true;
+                    }
+
+                    return false;
                 }

                 /// <summary>
@@ -319,8 +334,7 @@
                                 if (CharIsPrintable(c))
                                 {
                                     int start = i++;
-                                    for (; i < value.Length && !CharShouldBeEncoded(value[i]); ++i)
-                                        ;
+                                    while (i < value.Length && !CharShouldBeEncoded(value[i])) ++i;

                                     return value.Substring(start, (i--) - start);   // accumulate characters, mostly it is entire string value (faster)
                                 }
@@ -373,18 +387,33 @@
                         }
                     }

-                    var strVal = new StringBuilder(value.Length + 2);
-
-                    strVal.Append(Tokens.Quote);
-
-                    for (int i = 0; i < value.Length; ++i)
-                    {
-                        strVal.Append(EncodeStringIncremental(value, ref i));
-                    }
-
-                    strVal.Append(Tokens.Quote);
-
-                    _result.Append(strVal.ToString());
+                    if (value.Length == 0)
+                    {
+                        // empty string
+                        _result.Append(Tokens.DoubleQuoteString);   // ""
+                    }
+                    else if (!StringShouldBeEncoded(value)) // most common case
+                    {
+                        // string can be appended as it is
+                        _result.Append(Tokens.QuoteString);
+                        _result.Append(value);
+                        _result.Append(Tokens.QuoteString);
+                    }
+                    else
+                    {
+                        var strVal = new StringBuilder(value.Length + 4);
+
+                        strVal.Append(Tokens.Quote);
+
+                        for (int i = 0; i < value.Length; ++i)
+                        {
+                            strVal.Append(EncodeStringIncremental(value, ref i));
+                        }
+
+                        strVal.Append(Tokens.Quote);
+
+                        _result.Append(strVal.ToString());
+                    }
                 }

                 void WriteArray(PhpHashtable array)


SplDoublyLinkedList serialization fix

SplDoublyLinkedList serialization fix

--- src/Peachpie.Library/Spl/Datastructures.cs
+++ src/Peachpie.Library/Spl/Datastructures.cs
@@ -342,7 +342,7 @@
                 indexBefore--;

             var nodeBefore = GetNodeAtIndex(indexBefore);
-            baseList.AddAfter(nodeBefore, newval);
+            baseList.AddAfter(nodeBefore,   newval);
         }
         public virtual PhpValue bottom()
         {
@@ -390,7 +390,7 @@
         }
         public virtual void setIteratorMode(long mode)
         {
-            if(Enum.IsDefined(typeof(SPL_ITERATOR_MODE), mode))
+            if(Enum.IsDefined(typeof(SPL_ITERATOR_MODE), (SPL_ITERATOR_MODE)mode))
             {
                 iteratorMode = (SPL_ITERATOR_MODE)mode;
             } else
@@ -520,7 +520,7 @@
         /// <summary>
         /// Gets a serialized string representation of the List.
         /// </summary>
-        public virtual string serialize(Context _ctx)
+        public virtual PhpString serialize(Context _ctx)
         {
             // i:{iterator_mode};:i:{item0};:i:{item1},...;

@@ -528,19 +528,19 @@
             var serializer = PhpSerialization.PhpSerializer.Instance;

             // x:i:{iterator_mode};
-            result.Append("i:");
+            //result.Append("i:");
             result.Append(serializer.Serialize(_ctx, (int)this.iteratorMode, default(RuntimeTypeHandle)));
-            result.Append(";");
+            //result.Append(";");

             // :i:{item}
             foreach (var item in baseList)
             {
-                result.Append(":i:");
+                result.Append(":");
                 result.Append(serializer.Serialize(_ctx, item, default(RuntimeTypeHandle)));
-                result.Append(";");
-            }
-
-            return result.ToString();
+                //result.Append(";");
+            }
+
+            return new PhpString(result);
         }

         /// <summary>
@@ -561,15 +561,15 @@
                 var reader = new PhpSerialization.PhpSerializer.ObjectReader(_ctx, stream, default(RuntimeTypeHandle));

                 // i:
-                if (stream.ReadByte() != 'i') throw new InvalidDataException();
-                if (stream.ReadByte() != ':') throw new InvalidDataException();
+                //if (stream.ReadByte() != 'i') throw new InvalidDataException();
+                //if (stream.ReadByte() != ':') throw new InvalidDataException();

                 tmp = reader.Deserialize();
                 if (tmp.TypeCode != PhpTypeCode.Long) throw new InvalidDataException();
                 int iteratorMode = (int)tmp.ToLong();

                 // skip the ';'
-                if (stream.ReadByte() != ';') throw new InvalidDataException();
+                //if (stream.ReadByte() != ';') throw new InvalidDataException();

                 // :i:{item}
                 while (stream.ReadByte() != ':')


delegate

delegate

--- src/Kakuro.cs
+++ src/Kakuro.cs
@@ -112,7 +112,7 @@

     public static IList<IList<T>> PartitionN<T>(int n, IList<T> coll) => PartitionAll(n, n, coll);

-    public static List<ValueCell> SolveStep(IList<ValueCell> cells, int total) {
+    public static IList<ValueCell> SolveStep(IList<ValueCell> cells, int total) {
       int finalIndex = cells.Count - 1;
       var perms = PermuteAll(cells, total)
               .Where(v => IsPossible(cells.Last(), v[finalIndex]))


[Modify] Edit it

[Modify] Edit it

--- websocket-sharp/WebSocket.cs
+++ websocket-sharp/WebSocket.cs
@@ -2874,22 +2874,23 @@
     }

     /// <summary>
-    /// Sends binary data from the specified <see cref="Stream"/> asynchronously using
+    /// Sends the specified <paramref name="length"/> of data from
+    /// the specified <paramref name="stream"/> asynchronously using
     /// the WebSocket connection.
     /// </summary>
     /// <remarks>
-    /// This method doesn't wait for the send to be complete.
+    /// This method does not wait for the send to be complete.
     /// </remarks>
     /// <param name="stream">
-    /// A <see cref="Stream"/> from which contains the binary data to send.
+    /// A <see cref="Stream"/> from which reads the binary data to send.
     /// </param>
     /// <param name="length">
     /// An <see cref="int"/> that represents the number of bytes to send.
     /// </param>
     /// <param name="completed">
-    /// An <c>Action<bool></c> delegate that references the method(s) called when
-    /// the send is complete. A <see cref="bool"/> passed to this delegate is <c>true</c>
-    /// if the send is complete successfully.
+    /// An <c>Action<bool></c> delegate that invokes the method called when
+    /// the send is complete. A <see cref="bool"/> passed to this delegate will be
+    /// <c>true</c> if the send has done with no error.
     /// </param>
     public void SendAsync (Stream stream, int length, Action<bool> completed)
     {


[Modify] Throw exceptions

[Modify] Throw exceptions

--- websocket-sharp/WebSocket.cs
+++ websocket-sharp/WebSocket.cs
@@ -2883,12 +2883,40 @@
     /// </param>
     public void CloseAsync (ushort code, string reason)
     {
-      string msg;
-      if (!CheckParametersForClose (code, reason, _client, out msg)) {
-        _logger.Error (msg);
-        error ("An error has occurred in closing the connection.", null);
-
+      if (!code.IsCloseStatusCode ()) {
+        var msg = "Less than 1000 or greater than 4999.";
+        throw new ArgumentOutOfRangeException ("code", msg);
+      }
+
+      if (_client && code == 1011) {
+        var msg = "1011 cannot be used.";
+        throw new ArgumentException (msg, "code");
+      }
+
+      if (!_client && code == 1010) {
+        var msg = "1010 cannot be used.";
+        throw new ArgumentException (msg, "code");
+      }
+
+      if (reason.IsNullOrEmpty ()) {
+        closeAsync (code, String.Empty);
         return;
+      }
+
+      if (code == 1005) {
+        var msg = "1005 cannot be used.";
+        throw new ArgumentException (msg, "code");
+      }
+
+      byte[] bytes;
+      if (!reason.TryGetUTF8EncodedBytes (out bytes)) {
+        var msg = "It could not be UTF-8-encoded.";
+        throw new ArgumentException (msg, "reason");
+      }
+
+      if (bytes.Length > 123) {
+        var msg = "Its size is greater than 123 bytes.";
+        throw new ArgumentOutOfRangeException ("reason", msg);
       }

       closeAsync (code, reason);


Set use asp.net core in .net framework based tests to true by default.

--- src/Server/Bit.Test/TestEnvironmentBase.cs
+++ src/Server/Bit.Test/TestEnvironmentBase.cs
@@ -22,7 +22,7 @@
         public bool UseRealServer { get; set; }

 #if DotNet
-        public bool UseAspNetCore { get; set; } = false;
+        public bool UseAspNetCore { get; set; } = true;
 #else
         public bool UseAspNetCore { get; set; } = true;
 #endif


[Modify] Remove it

[Modify] Remove it

--- websocket-sharp/WebSocket.cs
+++ websocket-sharp/WebSocket.cs
@@ -887,23 +887,6 @@
              || _readyState == WebSocketState.Closed;
     }

-    private bool canSet (out string message)
-    {
-      message = null;
-
-      if (_readyState == WebSocketState.Open) {
-        message = "The connection has already been established.";
-        return false;
-      }
-
-      if (_readyState == WebSocketState.Closing) {
-        message = "The connection is closing.";
-        return false;
-      }
-
-      return true;
-    }
-
     // As server
     private bool checkHandshakeRequest (
       WebSocketContext context, out string message


Add regression test for dotnet/coreclr#2531

Ensure that en-US-POSIX does not get Turkish casing behavior.

--- src/System.Globalization/tests/TextInfo.cs
+++ src/System.Globalization/tests/TextInfo.cs
@@ -148,4 +148,18 @@
         // Greek Capital Letter Sigma (does not to case to U+03C2 with "final sigma" rule).
         Assert.Equal("\u03C3", ti.ToLower("\u03A3"));
     }
+
+    [Fact]
+    [PlatformSpecific(PlatformID.AnyUnix)]
+    public static void EnUsPosixIsNotATurkishCasingLocale()
+    {
+        // ICU has special tailoring for the en-US-POSIX locale which treats "i" and "I" as different letters
+        // instead of two letters with a case difference during collation.  Make sure this doesn't confuse our
+        // casing implementation, which uses collation to understand if we need to do turkish casing or not.
+
+        TextInfo ti = new CultureInfo("en-US-POSIX").TextInfo;
+
+        Assert.Equal('I', ti.ToUpper('i'));
+        Assert.Equal('i', ti.ToLower('I'));
+    }
 }


Update comment about Mono.Cecil

Update comment about Mono.Cecil

--- build/DocfxAnnotationGenerator/NuGetPackage.cs
+++ build/DocfxAnnotationGenerator/NuGetPackage.cs
@@ -48,9 +48,8 @@
                         var assemblyFile = Path.GetFileName(path);
                         using (var stream = entry.OpenEntryStream())
                         {
-                            // Mono.Cecil seems to have a problem with reading from the stream directly.
-                            // It's fine if we give it a MemoryStream.
-                            // TODO: File a bug.
+                            // Mono.Cecil requires the stream to be seekable. It's simplest
+                            // just to copy the whole DLL to a MemoryStream and pass that to Cecil.
                             var ms = new MemoryStream();
                             stream.CopyTo(ms);
                             ms.Position = 0;


MediaIndexPopulator should use IUmbracoContentIndex instead of UmbracoContentIndex

--- src/Umbraco.Examine/MediaIndexPopulator.cs
+++ src/Umbraco.Examine/MediaIndexPopulator.cs
@@ -10,7 +10,7 @@
     /// <summary>
     /// Performs the data lookups required to rebuild a media index
     /// </summary>
-    public class MediaIndexPopulator : IndexPopulator<UmbracoContentIndex>
+    public class MediaIndexPopulator : IndexPopulator<IUmbracoContentIndex>
     {
         private readonly int? _parentId;
         private readonly IMediaService _mediaService;
@@ -69,6 +69,6 @@
                 pageIndex++;
             } while (media.Length == pageSize);
         }
-
+
     }
 }


Fix that on startup the hamburger item is not selected

--- src/UwCore/Hamburger/HamburgerViewModel.cs
+++ src/UwCore/Hamburger/HamburgerViewModel.cs
@@ -79,7 +79,7 @@
             this.Actions.Changed.Subscribe(_ => this.UpdateSelectedAction());
             this.SecondaryActions.Changed.Subscribe(_ => this.UpdateSelectedAction());

-            eventAggregator.SubscribeScreen(this);
+            eventAggregator.Subscribe(this);
         }

         private void UpdateSelectedAction()