fixed ~we when multiple weathers are received

--- src/NadekoBot/Modules/Searches/Searches.cs
+++ src/NadekoBot/Modules/Searches/Searches.cs
@@ -51,7 +51,7 @@
                 .AddField(fb => fb.WithName("🌄 " + Format.Bold(GetText("sunrise"))).WithValue($"{data.sys.sunrise.ToUnixTimestamp():HH:mm} UTC").WithIsInline(true))
                 .AddField(fb => fb.WithName("🌇 " + Format.Bold(GetText("sunset"))).WithValue($"{data.sys.sunset.ToUnixTimestamp():HH:mm} UTC").WithIsInline(true))
                 .WithOkColor()
-                .WithFooter(efb => efb.WithText("Powered by openweathermap.org").WithIconUrl($"http://openweathermap.org/img/w/{string.Join(", ", data.weather.Select(w => w.icon))}.png"));
+                .WithFooter(efb => efb.WithText("Powered by openweathermap.org").WithIconUrl($"http://openweathermap.org/img/w/{data.weather[0].icon}.png"));
             await Context.Channel.EmbedAsync(embed).ConfigureAwait(false);
         }

@@ -217,7 +217,7 @@
             if (string.IsNullOrWhiteSpace(ffs))
                 return;

-            await Context.Channel.SendConfirmAsync(await NadekoBot.Google.ShortenUrl($"<http://lmgtfy.com/?q={ Uri.EscapeUriString(ffs) }>"))
+            await Context.Channel.SendConfirmAsync("<" + await NadekoBot.Google.ShortenUrl($"http://lmgtfy.com/?q={ Uri.EscapeUriString(ffs) }") + ">")
                            .ConfigureAwait(false);
         }


Add consistency test.

Add consistency test.

--- test/AsmResolver.DotNet.Tests/Code/Native/NativeMethodBodyTest.cs
+++ test/AsmResolver.DotNet.Tests/Code/Native/NativeMethodBodyTest.cs
@@ -1,4 +1,5 @@
 using System;
+using System.IO;
 using System.Linq;
 using AsmResolver.DotNet.Code.Native;
 using AsmResolver.DotNet.Signatures;
@@ -18,7 +19,7 @@
         private static NativeMethodBody CreateDummyBody(bool isVoid, bool is32Bit)
         {
             var module = ModuleDefinition.FromBytes(Properties.Resources.TheAnswer_NetFx);
-
+
             module.Attributes &= DotNetDirectoryFlags.ILOnly;
             if (is32Bit)
             {
@@ -41,13 +42,13 @@
                                      | MethodImplAttributes.PreserveSig;
             method.DeclaringType.Methods.Remove(method);
             module.GetOrCreateModuleType().Methods.Add(method);
-
+
             return method.NativeMethodBody = new NativeMethodBody(method);
         }

         private static CodeSegment GetNewCodeSegment(IPEImage image)
         {
-            var methodTable = image.DotNetDirectory.Metadata
+            var methodTable = image.DotNetDirectory!.Metadata!
                 .GetStream<TablesStream>()
                 .GetTable<MethodDefinitionRow>(TableIndex.Method);
             var row = methodTable.First(r => (r.ImplAttributes & MethodImplAttributes.Native) != 0);
@@ -99,18 +100,18 @@
                 0x67, 0x65, 0x64, 0x20, 0x77, 0x6f, 0x72,   // "ed worl"
                 0x6c, 0x64, 0x21, 0x00                      // "d!"
             };
-
+
             // Fix up reference to ucrtbased.dll!puts
             var ucrtbased = new ImportedModule("ucrtbased.dll");
             var puts = new ImportedSymbol(0x4fc, "puts");
             ucrtbased.Symbols.Add(puts);
-
+
             body.AddressFixups.Add(new AddressFixup(
                 0xD, AddressFixupType.Relative32BitAddress, puts
             ));

             // Serialize module to PE image.
-            var module = body.Owner.Module;
+            var module = body.Owner.Module!;
             var image = module.ToPEImage();

             // Verify import is added to PE image.
@@ -136,24 +137,24 @@
                 /* 19: */  0x5D,                                 // pop ebp
                 /* 1A: */  0xC3,                                 // ret
             };
-
+
             // Fix up reference to ucrtbased.dll!puts
             var ucrtbased = new ImportedModule("ucrtbased.dll");
             var puts = new ImportedSymbol(0x4fc, "puts");
             ucrtbased.Symbols.Add(puts);
-
+
             body.AddressFixups.Add(new AddressFixup(
                 0xD, AddressFixupType.Absolute32BitAddress, puts
             ));

             // Serialize module to PE image.
-            var module = body.Owner.Module;
+            var module = body.Owner.Module!;
             var image = module.ToPEImage();

             // Verify import is added to PE image.
             Assert.Contains(image.Imports, m =>
                 m.Name == ucrtbased.Name && m.Symbols.Any(s => s.Name == puts.Name));
-
+
             // Verify relocation is added.
             var segment = GetNewCodeSegment(image);
             Assert.Contains(image.Relocations, r =>
@@ -183,7 +184,7 @@
                 0x67, 0x65, 0x64, 0x20, 0x77, 0x6f, 0x72,   // "ed worl"
                 0x6c, 0x64, 0x21, 0x00                      // "d!"
             };
-
+
             // Add reference to ucrtbased.dll!puts at offset 0xD.
             var ucrtbased1 = new ImportedModule("ucrtbased.dll");
             var puts1 = new ImportedSymbol(0x4fc, "puts");
@@ -191,7 +192,7 @@
             body.AddressFixups.Add(new AddressFixup(
                 0xD, AddressFixupType.Relative32BitAddress, puts1
             ));
-
+
             // Add second (duplicated) reference to ucrtbased.dll!puts at offset 0x20.
             var ucrtbased2 = new ImportedModule("ucrtbased.dll");
             var puts2 = new ImportedSymbol(0x4fc, "puts");
@@ -201,7 +202,7 @@
             ));

             // Serialize module to PE image.
-            var module = body.Owner.Module;
+            var module = body.Owner.Module!;
             var image = module.ToPEImage();

             // Verify import is added to PE image.
@@ -212,5 +213,35 @@
             Assert.NotNull(importedSymbol);
             Assert.Equal(puts1.Name, importedSymbol.Name);
         }
+
+        [Fact]
+        public void ReadNativeMethodShouldResultInReferenceWithRightContents()
+        {
+            // Create native body.
+            var body = CreateDummyBody(false, false);
+            body.Code = new byte[]
+            {
+                0xb8, 0x39, 0x05, 0x00, 0x00, // mov rax, 1337
+                0xc3                          // ret
+            };
+
+            // Serialize module.
+            var module = body.Owner.Module!;
+            using var stream = new MemoryStream();
+            module.Write(stream);
+
+            // Reload and look up native method.
+            var newModule = ModuleDefinition.FromBytes(stream.ToArray());
+            var method = newModule.GetAllTypes().SelectMany(t => t.Methods).First(m => m.IsNative);
+
+            // Verify if code behind the entry address is consistent.
+            var reference = method.MethodBody?.Address;
+            Assert.NotNull(reference);
+            Assert.True(reference.CanRead);
+
+            byte[] newBuffer = new byte[body.Code.Length];
+            reference.CreateReader().ReadBytes(newBuffer, 0, newBuffer.Length);
+            Assert.Equal(body.Code, newBuffer);
+        }
     }
-}+}


feat(configurationmodel): make the set project attributes with invalid parameters test green.

--- test/Zuehlke.Eacm.Web.Backend.Tests/DomainModel/ProjectFixture.cs
+++ test/Zuehlke.Eacm.Web.Backend.Tests/DomainModel/ProjectFixture.cs
@@ -96,11 +96,7 @@
             var target = new Project(id, history);

             // act
-            target.SetProjectAttributes(name, description);
-
-            // assert
-            Assert.Equal(name, target.Name);
-            Assert.Equal(description, target.Description);
+            Assert.ThrowsAny<ArgumentException>(() => target.SetProjectAttributes(name, description));
         }
     }
 }


Update Encodings.cs

Update Encodings.cs

--- Shared/Cauldron.Core/Encodings.cs
+++ Shared/Cauldron.Core/Encodings.cs
@@ -41,8 +41,23 @@
         UTF8,

         /// <summary>
-        /// Encoding for the IBM EBCDIC format.
+        /// Encoding for the IBM EBCDIC format (US-Canada).
         /// </summary>
-        EBCDIC
+        EBCDIC_IBM037,
+
+        /// <summary>
+        /// Encoding for the IBM EBCDIC format (IBM Latin-1).
+        /// </summary>
+        EBCDIC_IBM01047,
+
+        /// <summary>
+        /// Encoding for the IBM EBCDIC format (US-Canada-Euro).
+        /// </summary>
+        EBCDIC_IBM01140,
+
+        /// <summary>
+        /// Encoding for the IBM EBCDIC format (Germany-Euro).
+        /// </summary>
+        EBCDIC_IBM01141,
     }
-}+}


Fix method name.

Fix method name.

--- SignalR.Client/Http/HttpHelper.cs
+++ SignalR.Client/Http/HttpHelper.cs
@@ -127,7 +127,7 @@
             }

             // Write the post data to the request stream
-            return request.GetRequestStreamAsync()
+            return request.GetHttpRequestStreamAsync()
                 .Then(stream => stream.WriteAsync(buffer).Then(() => stream.Dispose()))
                 .Then(() => request.GetHttpResponseAsync());
         }


Using backslash in globbing

Using backslash in globbing

--- src/test/Test.FAKECore/Globbing/TestSample3/GlobbingSample3Specs.cs
+++ src/test/Test.FAKECore/Globbing/TestSample3/GlobbingSample3Specs.cs
@@ -21,6 +21,14 @@
     public class when_scanning_for_txt_files : when_extracting_zip
     {
         Because of = () => Files = FileSystem.Search.find("temptest/**/*.txt").ToArray();
+
+        It should_match_1_file = () => Files.Length.ShouldEqual(1);
+        It should_find_names_txt = () => Files[0].ShouldEndWith("Names.txt");
+    }
+
+    public class when_scanning_for_txt_files_using_backslash : when_extracting_zip
+    {
+        Because of = () => Files = FileSystem.Search.find("temptest\\**\\*.txt").ToArray();

         It should_match_1_file = () => Files.Length.ShouldEqual(1);
         It should_find_names_txt = () => Files[0].ShouldEndWith("Names.txt");


Use ConcurrentDictionary for cache

Use ConcurrentDictionary for cache

--- tests/SixLabors.Fonts.Tests/TestFonts.cs
+++ tests/SixLabors.Fonts.Tests/TestFonts.cs
@@ -2,6 +2,7 @@
 // Licensed under the Apache License, Version 2.0.

 using System;
+using System.Collections.Concurrent;
 using System.Collections.Generic;
 using System.IO;
 using System.Linq;
@@ -12,7 +13,7 @@
 {
     public static class TestFonts
     {
-        private static readonly Dictionary<string, Stream> Cache = new();
+        private static readonly ConcurrentDictionary<string, Stream> Cache = new();

         public static string TwemojiMozillaFile => GetFullPath("Twemoji Mozilla.ttf");

@@ -227,27 +228,14 @@
             public static string Issue97File => GetFullPath("Issues/Issue97.fuzz");
         }

-        private static Stream OpenStream(string path)
-        {
-            if (Cache.ContainsKey(path))
-            {
-                return Cache[path].Clone();
-            }
-
-            lock (Cache)
-            {
-                if (Cache.ContainsKey(path))
+        private static Stream OpenStream(string path) =>
+            Cache.GetOrAdd(
+                path,
+                p =>
                 {
-                    return Cache[path].Clone();
-                }
-
-                using (FileStream fs = File.OpenRead(path))
-                {
-                    Cache.Add(path, fs.Clone());
-                    return Cache[path].Clone();
-                }
-            }
-        }
+                    using FileStream fs = File.OpenRead(p);
+                    return fs.Clone();
+                }).Clone();

         private static Stream Clone(this Stream src)
         {
@@ -271,9 +259,7 @@
             };

             IEnumerable<string> fullPaths = paths.Select(x => Path.GetFullPath(Path.Combine(root, x)));
-            string rootPath = fullPaths
-                                .Where(x => Directory.Exists(x))
-                                .FirstOrDefault();
+            string rootPath = fullPaths.FirstOrDefault(x => Directory.Exists(x));

             Assert.True(rootPath != null, $"could not find the font folder in any of these location, \n{string.Join("\n", fullPaths)}");


Adding parallelism to the K-Means algorithm.

--- Sources/Accord.MachineLearning/Clustering/KMeans.cs
+++ Sources/Accord.MachineLearning/Clustering/KMeans.cs
@@ -28,6 +28,9 @@
     using System;
     using Accord.Math;
     using Accord.Statistics.Distributions.Univariate;
+    using System.Threading.Tasks;
+    using System.Threading;
+    using Accord.Math.Comparers;

     /// <summary>
     ///   k-Means clustering algorithm.
@@ -230,7 +233,7 @@
         ///
         public KMeans(int k, Func<double[], double[], double> distance)
         {
-            if (k <= 0)
+            if (k <= 0)
                 throw new ArgumentOutOfRangeException("k");
             if (distance == null)
                 throw new ArgumentNullException("distance");
@@ -250,7 +253,7 @@
         ///
         public void Randomize(double[][] points, bool useSeeding = true)
         {
-            if (points == null)
+            if (points == null)
                 throw new ArgumentNullException("points");

             double[][] centroids = clusters.Centroids;
@@ -368,8 +371,9 @@
             for (int i = 0; i < newCentroids.Length; i++)
                 newCentroids[i] = new double[cols];

-            double[][,] covariances = clusters.Covariances;
-            double[] proportions = clusters.Proportions;
+            Object[] syncObjects = new Object[k];
+            for (int i = 0; i < syncObjects.Length; i++)
+                syncObjects[i] = new Object();

             bool shouldStop = false;
@@ -386,7 +390,7 @@
                 // information into the newClusters variable.

                 // For each point in the data set,
-                for (int i = 0; i < data.Length; i++)
+                Parallel.For(0, data.Length, i =>
                 {
                     // Get the point
                     double[] point = data[i];
@@ -395,12 +399,18 @@
                     int c = labels[i] = Clusters.Nearest(point);

                     // Increase the cluster's sample counter
-                    count[c]++;
-
-                    // Accumulate in the corresponding centroid
-                    for (int j = 0; j < point.Length; j++)
-                        newCentroids[c][j] += point[j];
-                }
+                    Interlocked.Increment(ref count[c]);
+
+                    // Get the closest cluster centroid
+                    double[] centroid = newCentroids[c];
+
+                    lock (syncObjects[c])
+                    {
+                        // Accumulate in the cluster centroid
+                        for (int j = 0; j < point.Length; j++)
+                            centroid[j] += point[j];
+                    }
+                });

                 // Next we will compute each cluster's new centroid
                 //  by dividing the accumulated sums by the number of
@@ -425,6 +435,23 @@
                 for (int i = 0; i < centroids.Length; i++)
                     for (int j = 0; j < centroids[i].Length; j++)
                         centroids[i][j] = newCentroids[i][j];
+            }
+
+            // Reorder clusters from larger to smaller
+            int[] reordering = Matrix.Indices(0, k);
+
+            Array.Sort(count, reordering, new GeneralComparer(ComparerDirection.Descending));
+            centroids.Swap(reordering);
+
+            for (int i = 0; i < labels.Length; i++)
+                labels[i] = reordering[labels[i]];
+
+
+
+            for (int i = 0; i < centroids.Length; i++)
+            {
+                // Compute the proportion of samples in the cluster
+                clusters.Proportions[i] = count[i] / (double)data.Length;
             }

@@ -439,20 +466,16 @@
                     if (sub.Length > 0)
                     {
                         // Compute the current cluster variance
-                        covariances[i] = Statistics.Tools.Covariance(sub, centroids[i]);
+                        clusters.Covariances[i] = Statistics.Tools.Covariance(sub, centroids[i]);
                     }
                     else
                     {
                         // The cluster doesn't have any samples
-                        covariances[i] = new double[cols, cols];
+                        clusters.Covariances[i] = new double[cols, cols];
                     }
-
-                    // Compute the proportion of samples in the cluster
-                    proportions[i] = (double)sub.Length / data.Length;
                 }
             }

-            clusters.Centroids = centroids;

             // Return the classification result
             return labels;


The TheOrderedDitherMethod cannot run parallel due to changes to the thresholds.xml file.

--- tests/Magick.NET.Tests/MagickImageTests/TheOrderedDitherMethod.cs
+++ tests/Magick.NET.Tests/MagickImageTests/TheOrderedDitherMethod.cs
@@ -2,7 +2,6 @@
 // Licensed under the Apache License, Version 2.0.

 using System;
-using System.IO;
 using ImageMagick;
 using Xunit;

@@ -10,6 +9,7 @@
 {
     public partial class MagickImageTests
     {
+        [Collection(nameof(RunTestsSeparately))]
         public class TheOrderedDitherMethod
         {
             [Fact]


FacebookApiException not thrown when error message does not contain code (fix #154)

--- Source/Facebook/FacebookClient.cs
+++ Source/Facebook/FacebookClient.cs
@@ -724,8 +724,10 @@
                 {
                     var errorType = error["type"] as string;
                     var errorMessage = error["message"] as string;
-                    int errorCode;
-                    int.TryParse(error["code"].ToString(), out errorCode);
+                    int errorCode = 0;
+
+                    if (error.ContainsKey("code"))
+                        int.TryParse(error["code"].ToString(), out errorCode);

                     // Check to make sure the correct data is in the response
                     if (!string.IsNullOrEmpty(errorType) && !string.IsNullOrEmpty(errorMessage))


Appropriate alert for not adding a rating.

--- SpaceBlog/SpaceBlog/Views/Shared/_CommentBox.cshtml
+++ SpaceBlog/SpaceBlog/Views/Shared/_CommentBox.cshtml
@@ -40,7 +40,7 @@
 <script>
     function SubmitComment() {
         if ($("#Rating").val() == "0") {
-            alert("Please rate this service provider.");
+            alert("Please rate the article.");
             return false;
         }
         else {


Implement TestOrganization method

Implement TestOrganization method

--- StressMeasurementSystem.Tests/Models/ContactTest.cs
+++ StressMeasurementSystem.Tests/Models/ContactTest.cs
@@ -96,6 +96,14 @@
             Assert.IsNull(name.Suffix);
         }

+        [Test]
+        public void TestOrganization()
+        {
+            var org = _contact.Organization;
+            Assert.AreEqual(org.Company, "Smith Co.");
+            Assert.AreEqual(org.JobTitle, "CEO");
+        }
+
         #endregion


Adding lower-case to file extension.

Adding lower-case to file extension.

--- Source/MapHack.Core/ImageTools.cs
+++ Source/MapHack.Core/ImageTools.cs
@@ -104,7 +104,7 @@
                 {
                     Directory.CreateDirectory(directory);
                 }
-                var path = Path.Combine(directory, String.Concat(filename, ".", tile.Format.ToString()));
+                var path = Path.Combine(directory, String.Concat(filename, ".", tile.Format.ToString().ToLower()));
                 tile.Write(path);
                 x++;
                 if (x == dimension)


Adding a failing unit test about BlobCounters

--- Test/Lokad.Cloud.Framework.Test/BlobCounterTests.cs
+++ Test/Lokad.Cloud.Framework.Test/BlobCounterTests.cs
@@ -3,6 +3,9 @@
 // URL: http://www.lokad.com/
 #endregion

+using System;
+using System.Linq;
+using System.Threading;
 using Lokad.Cloud.Azure.Test;
 using NUnit.Framework;

@@ -41,5 +44,63 @@
 			Assert.IsTrue(flag1, "#A03");
 			Assert.IsFalse(flag2, "#A04");
 		}
+
+		[Test]
+		public void IncrementMultiThread()
+		{
+			//setting the provider
+			var provider = GlobalSetup.Container.Resolve<IBlobStorageProvider>();
+			provider.CreateContainer(ContainerName);
+
+			//creating the threads
+			const int threadsCount = 20;
+			var threads = Enumerable.Range(0, threadsCount)
+									.Select(i => new Thread(Increment))
+									.ToArray();
+
+			var random = new Random();
+			var increments = Range.Array(threadsCount).Select(e => Range.Array(100).Select(i => random.Next(20) - 10).ToArray()).ToArray();
+			int sum = increments.Sum(e => e.Sum());
+
+			//creating thread parameters
+			var counter = new BlobCounter(provider, ContainerName, "SomeBlobName");
+			counter.Reset(0);
+
+			Thread.Sleep(2000);
+
+			var threadParameters = Enumerable.Range(0, threadsCount).Select(i =>
+				new CounterParameters()
+				{
+					BlobCounter = new BlobCounter(provider, ContainerName, "SomeBlobName"),
+					Increments = increments[i]
+				}).ToArray();
+
+			//Starting threads
+			Enumerable.Range(0, threadsCount).ForEach(i => threads[i].Start(threadParameters[i]));
+
+			Thread.Sleep(2000);
+
+			Assert.AreEqual(sum, counter.GetValue(), "values should be equal, BlobCounter supposed to be thread-safe");
+		}
+
+		static void Increment(object parameters)
+		{
+			if (parameters is CounterParameters)
+			{
+				var currentCounters = (CounterParameters)parameters;
+
+				foreach (var increment in currentCounters.Increments)
+				{
+					currentCounters.BlobCounter.Increment(increment);
+				}
+			}
+		}
+
+		class CounterParameters
+		{
+			public BlobCounter BlobCounter { get; set; }
+
+			public int[] Increments { get; set; }
+		}
 	}
 }


#1004 Added test for serialization of SavedSearch

--- Tests/xUnitinvi/EndToEnd/JsonClientEndToEndTests.cs
+++ Tests/xUnitinvi/EndToEnd/JsonClientEndToEndTests.cs
@@ -186,6 +186,21 @@
         }

         [Fact]
+        public async Task SavedSearch()
+        {
+            if (!EndToEndTestConfig.ShouldRunEndToEndTests)
+                return;
+
+            var savedSearch = await _tweetinviTestClient.Search.CreateSavedSearch("sandwiches");
+            await _tweetinviTestClient.Search.DestroySavedSearch(savedSearch);
+
+            TestSerializer<ISavedSearch, ISavedSearch>(savedSearch, deserializedSavedSearch =>
+            {
+                Assert.Equal(savedSearch.Query, deserializedSavedSearch.Query);
+            });
+        }
+
+        [Fact]
         public void Credentials()
         {
             if (!EndToEndTestConfig.ShouldRunEndToEndTests)


Fixes #138

Fixes #138

--- Torch/Managers/PatchManager/MSIL/MsilInstruction.cs
+++ Torch/Managers/PatchManager/MSIL/MsilInstruction.cs
@@ -7,7 +7,6 @@
 using System.Text;
 using Torch.Managers.PatchManager.Transpile;
 using Torch.Utils;
-using Label = System.Windows.Controls.Label;

 namespace Torch.Managers.PatchManager.MSIL
 {


Remove workaround in tests for Windows RuntimeIdentifier that's no longer needed

--- test/Microsoft.NET.TestFramework/ProjectConstruction/TestProject.cs
+++ test/Microsoft.NET.TestFramework/ProjectConstruction/TestProject.cs
@@ -153,11 +153,6 @@
                 if (!string.IsNullOrEmpty(this.RuntimeIdentifier))
                 {
                     propertyGroup.Add(new XElement(ns + "RuntimeIdentifier", this.RuntimeIdentifier));
-                }
-
-                if (this.IsExe && targetFrameworks.Any(identifier => GetShortTargetFrameworkIdentifier(identifier).Equals("net", StringComparison.OrdinalIgnoreCase)))
-                {
-                    propertyGroup.Add(new XElement(ns + "RuntimeIdentifier", "win7-x86"));
                 }

                 //  Update SDK reference to the version under test


Fixing the library case, project reference.

--- test/Microsoft.NET.TestFramework/ProjectConstruction/TestProject.cs
+++ test/Microsoft.NET.TestFramework/ProjectConstruction/TestProject.cs
@@ -242,7 +242,7 @@
 ";
                     foreach (var dependency in this.ReferencedProjects)
                     {
-                        source += $"        public static string {dependency.Name} {{ get {{ return {dependency.Name}; }} }}" + Environment.NewLine;
+                        source += $"        public string {dependency.Name}Name {{ get {{ return {dependency.Name}.{dependency.Name}Class.Name; }} }}" + Environment.NewLine;
                     }

                     source +=


David/Mo #1049 - Fixing unit tests

David/Mo #1049 - Fixing unit tests

--- test/StockportWebappTests/Unit/Repositories/EventRepositoryTests.cs
+++ test/StockportWebappTests/Unit/Repositories/EventRepositoryTests.cs
@@ -81,7 +81,7 @@
         {
             _emailClient.Setup(e => e.SendEmailToService(It.Is<EmailMessage>(message => message.ToEmail == AppSetting.GetAppSetting("EventSubmissionEmail").ToString()))).ReturnsAsync(HttpStatusCode.OK);

-            var response = await _eventsRepository.SendEmailMessage(new EventSubmission());
+            var response = await _eventsRepository.SendEmailMessage(new EventSubmission() {EventDate = new DateTime(2017, 9, 9) });

             response.Should().Be(HttpStatusCode.OK);
         }
@@ -89,7 +89,7 @@
         [Fact]
         public async void ItShouldLogThatAnEmailWasSent()
         {
-            var eventSubmission = new EventSubmission { SubmitterEmail = "test@testing.xyz" };
+            var eventSubmission = new EventSubmission { SubmitterEmail = "test@testing.xyz", EventDate = new DateTime(2017,9,9)};
             await _eventsRepository.SendEmailMessage(eventSubmission);

             LogTesting.Assert(_logger, LogLevel.Information, "Sending event submission form email");
@@ -99,7 +99,7 @@
         [Fact]
         public async void ItShouldReturnFeaturedEventsFirst()
         {
-            var eventSubmission = new EventSubmission { SubmitterEmail = "test@testing.xyz" };
+            var eventSubmission = new EventSubmission { SubmitterEmail = "test@testing.xyz", EventDate = new DateTime(2017, 9, 9) };
             await _eventsRepository.SendEmailMessage(eventSubmission);

             LogTesting.Assert(_logger, LogLevel.Information, "Sending event submission form email");


Add unit test

Add unit test

--- UnitTestUsefullFunctions/UnitTestFunctionsPrimes.cs
+++ UnitTestUsefullFunctions/UnitTestFunctionsPrimes.cs
@@ -1034,10 +1034,18 @@
       int result = FunctionsPrimes.Pi(source);
       Assert.AreEqual(result, expected);
     }
+
+    public void TestMethod_Pi_431()
+    {
+      const int source = 431;
+      const int expected = 83;
+      int result = FunctionsPrimes.Pi(source);
+      Assert.AreEqual(result, expected);
+    }

     /* Primes between 2 and 4000

-    419    421    431    433    439    443    449    457    461    463
+    431    433    439    443    449    457    461    463
     467    479    487    491    499    503    509    521    523    541
     547    557    563    569    571    577    587    593    599    601
     607    613    617    619    631    641    643    647    653    659


add unit test

add unit test

--- UnitTestUsefullFunctions/UnitTestFunctionsPrimes.cs
+++ UnitTestUsefullFunctions/UnitTestFunctionsPrimes.cs
@@ -1005,6 +1005,15 @@
     {
       const int source = 401;
       const int expected = 79;
+      int result = FunctionsPrimes.Pi(source);
+      Assert.AreEqual(result, expected);
+    }
+
+    [TestMethod]
+    public void TestMethod_Pi_409()
+    {
+      const int source = 409;
+      const int expected = 80;
       int result = FunctionsPrimes.Pi(source);
       Assert.AreEqual(result, expected);
     }


Add unit tests for NumberToEnglishWords method

--- UnitTestUsefullFunctions/UnitTestFunctionsString.cs
+++ UnitTestUsefullFunctions/UnitTestFunctionsString.cs
@@ -2712,5 +2712,13 @@
       string result = StringFunc.NumberToEnglishWords(60);
       Assert.AreEqual(result, expected);
     }
+
+    [TestMethod]
+    public void TestMethod_NumberToWordsEnglish_seventy()
+    {
+      string expected = "seventy";
+      string result = StringFunc.NumberToEnglishWords(70);
+      Assert.AreEqual(result, expected);
+    }
   }
 }


feat(vote): add restart vote cooldowns

feat(vote): add restart vote cooldowns

--- UnityProject/Assets/Scripts/Voting/VotingManager.cs
+++ UnityProject/Assets/Scripts/Voting/VotingManager.cs
@@ -23,6 +23,28 @@

 	private bool voteRestartSuccess = false;

+	/// <summary>
+	/// The initial time during a round before a vote can be started
+	/// </summary>
+	[SerializeField]
+	private float RoundStartCooldownTime = 300f;
+
+	/// <summary>
+	/// The cooldown time between votes
+	/// </summary>
+	[SerializeField]
+	private float CooldownTime = 60f;
+
+	/// <summary>
+	/// Is voting disabled due to the cooldown being active?
+	/// </summary>
+	private bool isCooldownActive;
+
+	/// <summary>
+	/// The active cooldown Coroutine
+	/// </summary>
+	private Coroutine cooldown;
+
 	private void Awake()
 	{
 		if (Instance == null)
@@ -32,6 +54,30 @@
 		else
 		{
 			Destroy(gameObject);
+		}
+	}
+
+	void OnEnable()
+	{
+		EventManager.AddHandler(EVENT.RoundStarted, OnRoundStarted);
+		EventManager.AddHandler(EVENT.RoundEnded, OnRoundEnded);
+	}
+
+	void OnDisable()
+	{
+		EventManager.RemoveHandler(EVENT.RoundStarted, OnRoundStarted);
+		EventManager.RemoveHandler(EVENT.RoundEnded, OnRoundEnded);
+	}
+
+	void OnRoundStarted()
+	{
+		cooldown = StartCoroutine(StartVoteCooldown(RoundStartCooldownTime));
+	}
+	void OnRoundEnded()
+	{
+		if (cooldown != null)
+		{
+			StopCoroutine(cooldown);
 		}
 	}

@@ -39,6 +85,12 @@
 	public void TryInitiateRestartVote(GameObject instigator)
 	{
 		if (voteInProgress || voteRestartSuccess) return;
+
+		if (isCooldownActive)
+		{
+			Chat.AddExamineMsgFromServer(instigator, $"Too soon to trigger a restart vote!");
+			return;
+		}

 		votes.Clear();
 		countTime = 0f;
@@ -81,6 +133,16 @@
 		}
 	}

+	/// <summary>
+	/// Coroutine to time the cooldown period
+	/// </summary>
+	private IEnumerator StartVoteCooldown(float time)
+	{
+		isCooldownActive = true;
+		yield return WaitFor.Seconds(time);
+		isCooldownActive = false;
+	}
+
 	private void CheckVoteCriteria(bool stopVoteIfSuccess = false)
 	{
 		if (IsSuccess(ForVoteCount(), PlayerList.Instance.AllPlayers.Count))
@@ -120,6 +182,7 @@

 	private void FinishVote()
 	{
+		StartCoroutine(StartVoteCooldown(CooldownTime));
 		RpcFinishVote();
 	}


[SharpDX.Core] Fixed WinRT build - added missing 'using' directive'

--- Source/SharpDX/ShadowContainer.cs
+++ Source/SharpDX/ShadowContainer.cs
@@ -19,10 +19,11 @@
 // THE SOFTWARE.
 using System;
 using System.Collections.Generic;
-using System.Runtime.InteropServices;
+using System.Runtime.InteropServices;
+using System.Reflection;

 namespace SharpDX
-{
+{
     /// <summary>
     /// The ShadowContainer is the main container used internally to keep references to all native COM/C++ callbacks.
     /// It is stored in the property <see cref="ICallbackable.Shadow"/>.


Fixing tests that contains inner classes.

--- ReachingTypeAnalysis/Tests/BasicTest.cs
+++ ReachingTypeAnalysis/Tests/BasicTest.cs
@@ -510,18 +510,21 @@
         {
 			#region source code
 			var source =
-@"class MainClass {
-    class SuperClass {
-        public virtual void M() {
-
-        }
-    }
-    class SubClass : SuperClass {
-        public override void M() {
-        }
-    }
-
-    static void Main(string[] argv) {
+@"
+class SuperClass
+{
+    public virtual void M() { }
+}
+
+class SubClass : SuperClass
+{
+    public override void M() { }
+}
+
+class MainClass
+{
+    static void Main(string[] argv)
+	{
         SuperClass oSub = new SubClass();
         oSub.M(); // SubClass.M() should be reachable.
     }
@@ -540,20 +543,24 @@
         {
 			#region source code
 			var source =
-@"class MainClass {
-    interface Interface {
-        void M(int x);
-    }
-    class SubClass : Interface {
-        public void M(int x) {
-
-        }
-    }
-
-    static void Main(string[] argv) {
-        var oSub = new SubClass();
-        oSub.M(4); // SubClass.M() should be reachable.
-    }
+@"
+interface Interface
+{
+	void M(int x);
+}
+
+class SubClass : Interface
+{
+	public void M(int x) { }
+}
+
+class MainClass
+{
+	static void Main(string[] argv)
+	{
+		var oSub = new SubClass();
+		oSub.M(4); // SubClass.M() should be reachable.
+	}
 }";
 			#endregion

@@ -732,23 +739,25 @@
         {
 			#region source code
 			var source =
-      @"class MainClass {
-  delegate void DoSomethingDelegate();
-
-  class M {
-      public static void S() {}
-      public static void Unreachable() {}
-   }
-    static void Test()
-    {
-    }
-
-    static void Main(string[] argv) {
-       DoSomethingDelegate d = M.S;
-       DoSomethingDelegate d2 = Test;
-
-       d();
-    }
+@"
+class M
+{
+	public static void S() { }
+	public static void Unreachable() { }
+}
+
+class MainClass
+{
+	delegate void DoSomethingDelegate();
+
+	static void Test() { }
+
+	static void Main(string[] argv)
+	{
+		DoSomethingDelegate d = M.S;
+		DoSomethingDelegate d2 = Test;
+		d();
+	}
 }";
 			#endregion

@@ -769,23 +778,28 @@
         {
 			#region source code
 			var source =
-      @"class MainClass {
-  delegate void DoSomethingDelegate();
-  interface HasS {
-     void S();
-  }
-  class SubClass : HasS {
-      public void S() {}
-      public void Unreachable() {}
-   }
-
-    static void Main(string[] argv) {
-      HasS s = new SubClass();
-
-       DoSomethingDelegate d = s.S;
-
-       d();
-    }
+@"
+interface HasS
+{
+	void S();
+}
+
+class SubClass : HasS
+{
+	public void S() { }
+	public void Unreachable() { }
+}
+
+class MainClass
+{
+	delegate void DoSomethingDelegate();
+
+	static void Main(string[] argv)
+	{
+		HasS s = new SubClass();
+		DoSomethingDelegate d = s.S;
+		d();
+	}
 }";
 			#endregion


fix(Playground): Disable dev support for ReleaseBundle configuration (#695)

We don't want to disable dev support for all Release builds (the 'Release' configuration still expects to communicate with the bundle server). Instead, we'll just disable it for the ReleaseBundle configuration.

Towards #692

--- ReactWindows/Playground/AppReactPage.cs
+++ ReactWindows/Playground/AppReactPage.cs
@@ -48,7 +48,11 @@
         {
             get
             {
+#if !BUNDLE || DEBUG
                 return true;
+#else
+                return false;
+#endif
             }
         }
     }


ApplicationBar

ApplicationBar

--- RealMortgageCalculator/MainPage.xaml.cs
+++ RealMortgageCalculator/MainPage.xaml.cs
@@ -19,7 +19,7 @@
             InitializeComponent();

             // Código de ejemplo para traducir ApplicationBar
-            //BuildLocalizedApplicationBar();
+            BuildLocalizedApplicationBar();
         }

         // Código de ejemplo para compilar una ApplicationBar traducida


- Renamed FixtureInitialize to IntializeNHibernateAndIoC (and IntializeNHibernate)
- Added references to classes that were missed from VS2005 proj

git-svn-id: 6eea8ec865c4fa60105bc56808c028bdcf72a817@1309 079b0acf-d9fa-0310-9935-e5ade295c882

--- Rhino.Security.Tests/DatabaseFixture.cs
+++ Rhino.Security.Tests/DatabaseFixture.cs
@@ -20,7 +20,7 @@
 		{
 			Security.PrepareForActiveRecordInitialization<User>(SecurityTableStructure.Prefix);
 			MappingInfo from = MappingInfo.From(typeof(IUser).Assembly, typeof(User).Assembly);
-			FixtureInitialize(PersistenceFramework.ActiveRecord, "windsor.boo", GetDatabaseEngine(), from);
+			IntializeNHibernateAndIoC(PersistenceFramework.ActiveRecord, "windsor.boo", GetDatabaseEngine(), from);
 			CurrentContext.CreateUnitOfWork();

 			SetupEntities();


nasdngosdn

nasdngosdn

--- source/AARAOFMD/frm_Registration.cs
+++ source/AARAOFMD/frm_Registration.cs
@@ -29,7 +29,7 @@

         #region Constructor

-        //Normal Constructor
+        //Normal Constructor lkvndflkhndfl
                 public frm_Registration()
                 {
                     InitializeComponent();


Little fix.

Little fix.

--- source/Cosmos.HAL2/PS2Controller.cs
+++ source/Cosmos.HAL2/PS2Controller.cs
@@ -642,3 +642,4 @@

         #endregion
     }
+}


CP-8120 Cores-per-socket: When building the topology list ignore the maximum number of cores-per-socket (i.e. number of cores per socket on the underlying server) if this is zero, for example because the socket information is not available on 6.1 servers.

Signed-off-by: Mihaela Stoica <be95049f8e30d921fc7e2579c00c48bd84c40606@citrix.com>

--- XenAdmin/Controls/ComboBoxes/CPUTopologyComboBox.cs
+++ XenAdmin/Controls/ComboBoxes/CPUTopologyComboBox.cs
@@ -85,7 +85,7 @@
         private static List<TopologyTuple> GetTopologies(long noOfVCPUs, long maxNoOfCoresPerSocket)
         {
             var result = new List<TopologyTuple>();
-            var maxCoresPerSocket = Math.Min(noOfVCPUs, maxNoOfCoresPerSocket);
+            var maxCoresPerSocket = maxNoOfCoresPerSocket > 0 ? Math.Min(noOfVCPUs, maxNoOfCoresPerSocket) : noOfVCPUs;
             for (var cores = 1; cores <= maxCoresPerSocket; cores++)
             {
                 if (noOfVCPUs % cores == 0)


Don't execute same script more than once at the same time

--- Xpressive.Home/Automation/ScriptExecutionContext.cs
+++ Xpressive.Home/Automation/ScriptExecutionContext.cs
@@ -11,6 +11,8 @@
     internal class ScriptExecutionContext
     {
         private static readonly ILog _log = LogManager.GetLogger(typeof(ScriptExecutionContext));
+        private static readonly HashSet<Guid> _currentlyExecuting = new HashSet<Guid>();
+        private static readonly object _lock = new object();
         private readonly Script _script;
         private readonly IEnumerable<IScriptObjectProvider> _objectProviders;

@@ -37,14 +39,20 @@

         private void ExecuteAsTask()
         {
+            lock (_lock)
+            {
+                if (_currentlyExecuting.Contains(_script.Id))
+                {
+                    return;
+                }
+                _currentlyExecuting.Add(_script.Id);
+            }
+
             _log.Info($"Execute script {_script.Name} ({_script.Id.ToString("n")})");
-
-            var engine = new Engine(cfg => cfg.TimeoutInterval(TimeSpan.FromSeconds(30)));
-
-            SetupScriptEngine(engine);

             try
             {
+                var engine = SetupScriptEngine();
                 engine.Execute(_script.JavaScript);
             }
             catch (JavaScriptException e)
@@ -55,10 +63,17 @@
             {
                 _log.Error($"Error when executing script {_script.Name} ({_script.Id.ToString("n")})", e);
             }
+
+            lock (_lock)
+            {
+                _currentlyExecuting.Remove(_script.Id);
+            }
         }

-        private void SetupScriptEngine(Engine engine)
+        private Engine SetupScriptEngine()
         {
+            var engine = new Engine(cfg => cfg.TimeoutInterval(TimeSpan.FromSeconds(30)));
+
             foreach (var objectProvider in _objectProviders)
             {
                 foreach (var tuple in objectProvider.GetObjects())
@@ -71,6 +86,8 @@
                     engine.SetValue(tuple.Item1, tuple.Item2);
                 }
             }
+
+            return engine;
         }
     }
 }


Utilized FakeItEasy for the interaction with INamingConvention

.. since NamingConventionTests already tests the behavior of each convention

--- YamlDotNet.Test/Serialization/SerializationTests.cs
+++ YamlDotNet.Test/Serialization/SerializationTests.cs
@@ -26,6 +26,7 @@
 using System.IO;
 using System.Reflection;
 using System.Text.RegularExpressions;
+using FakeItEasy;
 using FluentAssertions;
 using Xunit;
 using YamlDotNet.Core;
@@ -624,114 +625,33 @@
 		}

 		[Fact]
-		// Todo: are these needed? Naming convention classes are tested elsewhere
-		public void SerializeUsingCamelCaseNamingConvention()
-		{
-			var obj = new { foo = "bar", moreFoo = "More bar", evenMoreFoo = "Awesome" };
-
-			var result = SerializeWithNaming(obj, new CamelCaseNamingConvention());
-
-			result.Should().Contain("foo: bar").And
-				.Contain("moreFoo: More bar").And
-				.Contain("evenMoreFoo: Awesome");
-		}
-
-		[Fact]
-		public void DeserializeUsingCamelCaseNamingConvention()
-		{
-			DeserializeUsing(new CamelCaseNamingConvention(),
-				"firstTest: First",
-				"secondTest: Second",
-				"thirdTest: Third",
-				"fourthTest: Fourth");
-		}
-
-		[Fact]
-		public void SerializeUsingPascalCaseNamingConvention()
-		{
-			var obj = new { foo = "bar", moreFoo = "More bar", evenMoreFoo = "Awesome" };
-
-			var result = SerializeWithNaming(obj, new PascalCaseNamingConvention());
-
-			result.Should().Contain("Foo: bar").And
-				.Contain("MoreFoo: More bar").And
-				.Contain("EvenMoreFoo: Awesome");
-		}
-
-		[Fact]
-		public void DeserializeUsingPascalCaseNamingConvention()
-		{
-			DeserializeUsing(new PascalCaseNamingConvention(),
-				"FirstTest: First",
-				"SecondTest: Second",
-				"ThirdTest: Third",
-				"fourthTest: Fourth");
-		}
-
-		[Fact]
-		public void SerializeUsingHyphenationNamingConvention()
-		{
-			var obj = new { foo = "bar", moreFoo = "More bar", EvenMoreFoo = "Awesome" };
-
-			var result = SerializeWithNaming(obj, new HyphenatedNamingConvention());
-
-			result.Should().Contain("foo: bar").And
-				.Contain("more-foo: More bar").And
-				.Contain("even-more-foo: Awesome");
-		}
-
-		[Fact]
-		public void DeserializeUsingHyphenatedNamingConvention()
-		{
-			DeserializeUsing(new HyphenatedNamingConvention(),
-				"first-test: First",
-				"second-test: Second",
-				"third-test: Third",
-				"fourthTest: Fourth");
-		}
-
-		[Fact]
-		public void SerializeUsingUnderscoredNamingConvention()
-		{
-			var obj = new { foo = "bar", moreFoo = "More bar", EvenMoreFoo = "Awsome" };
-
-			var result = SerializeWithNaming(obj, new UnderscoredNamingConvention());
-
-			result.Should().Contain("foo: bar").And
-				.Contain("more_foo: More bar").And
-				.Contain("even_more_foo: Awsome");
-		}
-
-		[Fact]
-		public void DeserializeUsingUnderscoredNamingConvention()
-		{
-			DeserializeUsing(new UnderscoredNamingConvention(),
-				"first_test: First",
-				"second_test: Second",
-				"third_test: Third",
-				"fourthTest: Fourth");
-		}
-
-		private string SerializeWithNaming<T>(T input, INamingConvention naming)
-		{
-			var serializer = new Serializer(namingConvention: naming);
-			var writer = new StringWriter();
-			serializer.Serialize(writer, input, typeof(T));
-			return writer.ToString();
-		}
-
-		private void DeserializeUsing(INamingConvention convention, params string[] yaml)
-		{
+		public void SerializaionUtilizeNamingConventions()
+		{
+			var convention = A.Fake<INamingConvention>();
+			A.CallTo(() => convention.Apply(A<string>._)).ReturnsLazily((string x) => x);
+			var obj = new NameConvention { FirstTest = "1", SecondTest = "2" };
+
+			var serializer = new Serializer(namingConvention: convention);
+			serializer.Serialize(new StringWriter(), obj);
+
+			A.CallTo(() => convention.Apply("FirstTest")).MustHaveHappened();
+			A.CallTo(() => convention.Apply("SecondTest")).MustHaveHappened();
+		}
+
+		[Fact]
+		public void DeserializationUtilizeNamingConventions()
+		{
+			var convention = A.Fake<INamingConvention>();
+			A.CallTo(() => convention.Apply(A<string>._)).ReturnsLazily((string x) => x);
+			var text = Lines(
+				"FirstTest: 1",
+				"SecondTest: 2");
+
 			var deserializer = new Deserializer(namingConvention: convention);
-
-			var result = deserializer.Deserialize<NameConvention>(UsingReaderFor(Lines(yaml)));
-
-			result.ShouldHave().SharedProperties().EqualTo(new {
-				FirstTest = "First",
-				SecondTest = "Second",
-				ThirdTest = "Third",
-				AliasTest = "Fourth"
-			});
+			deserializer.Deserialize<NameConvention>(UsingReaderFor(text));
+
+			A.CallTo(() => convention.Apply("FirstTest")).MustHaveHappened();
+			A.CallTo(() => convention.Apply("SecondTest")).MustHaveHappened();
 		}
 	}
 }


Resume timers and restart using a recent input in the same window if possible

--- Hourglass/TimerMenu.cs
+++ Hourglass/TimerMenu.cs
@@ -386,7 +386,10 @@
             TimerInput input = (TimerInput)menuItem.Tag;
             input.Options.SetFromTimerOptions(this.timerWindow.Timer.Options);

-            TimerWindow window = new TimerWindow();
+            TimerWindow window = this.timerWindow.Timer.State == TimerState.Stopped || this.timerWindow.Timer.State == TimerState.Expired
+                ? this.timerWindow
+                : new TimerWindow();
+
             window.Show(input);
         }

@@ -473,7 +476,10 @@
             MenuItem menuItem = (MenuItem)sender;
             HourglassTimer savedTimer = (HourglassTimer)menuItem.Tag;

-            TimerWindow window = new TimerWindow();
+            TimerWindow window = this.timerWindow.Timer.State == TimerState.Stopped || this.timerWindow.Timer.State == TimerState.Expired
+                ? this.timerWindow
+                : new TimerWindow();
+
             window.Show(savedTimer);
         }


small adjustment of the gray scale algorithm

git-svn-id: 98f681d7a2907ee2a41df434552134740bcc8829@86205 81fbe566-5dc4-48c1-bdea-7421811ca204

--- Source/lib/BaseLuminanceSource.cs
+++ Source/lib/BaseLuminanceSource.cs
@@ -27,10 +27,10 @@
       // the following channel weights give nearly the same
       // gray scale picture as the java version with BufferedImage.TYPE_BYTE_GRAY
       // they are used in sub classes for luminance / gray scale calculation
-      protected const int RChannelWeight = 77;
-      protected const int GChannelWeight = 150;
-      protected const int BChannelWeight = 29;
-      protected const int ChannelWeight = 8;
+      protected const int RChannelWeight = 19562;
+      protected const int GChannelWeight = 38550;
+      protected const int BChannelWeight = 7424;
+      protected const int ChannelWeight = 16;

       /// <summary>
       ///


Update build.cake

Update build.cake

--- ImageCircle/build.cake
+++ ImageCircle/build.cake
@@ -1,6 +1,6 @@
 #addin "Cake.FileHelpers"

-var TARGET = Argument ("target", Argument ("t", "Build"));
+var TARGET = Argument ("target", Argument ("t", "NuGetPack"));

 var version = EnvironmentVariable ("APPVEYOR_BUILD_VERSION") ?? Argument("version", "0.0.9999");

@@ -34,4 +34,4 @@
 });

-RunTarget (TARGET);+RunTarget (TARGET);


Base type constraint should be verified under C# 7.

--- src/Analyzers/CSharp/Tests/UseIsNullCheck/UseIsNullCheckForReferenceEqualsTests.cs
+++ src/Analyzers/CSharp/Tests/UseIsNullCheck/UseIsNullCheckForReferenceEqualsTests.cs
@@ -530,7 +530,7 @@
             return;
         }
     }
-}");
+}", new TestParameters(parseOptions: CSharp7));
         }

         [WorkItem(23581, "https://github.com/dotnet/roslyn/issues/47972")]


Add information for metadata fail. (#665)

--- src/Microsoft.DocAsCode.Metadata.ManagedReference/Visitors/SymbolVisitorAdapter.cs
+++ src/Microsoft.DocAsCode.Metadata.ManagedReference/Visitors/SymbolVisitorAdapter.cs
@@ -15,6 +15,7 @@

     using Microsoft.DocAsCode.Common;
     using Microsoft.DocAsCode.DataContracts.ManagedReference;
+    using Microsoft.DocAsCode.Exceptions;

     public class SymbolVisitorAdapter
         : SymbolVisitor<MetadataItem>
@@ -430,7 +431,14 @@
             IReadOnlyList<string> typeGenericParameters = null,
             IReadOnlyList<string> methodGenericParameters = null)
         {
-            return _generator.AddSpecReference(symbol, typeGenericParameters, methodGenericParameters, _references, this);
+            try
+            {
+                return _generator.AddSpecReference(symbol, typeGenericParameters, methodGenericParameters, _references, this);
+            }
+            catch (Exception ex)
+            {
+                throw new DocfxException($"Unable to generate spec reference for {VisitorHelper.GetCommentId(symbol)}", ex);
+            }
         }

         #endregion


1007: EditableTextFlowLayer.Bottom

1007: EditableTextFlowLayer.Bottom

--- src/PixelFarm/PaintLab.RenderTree.TextSurface/1.3_Layer/1_EditableTextFlowLayer.cs
+++ src/PixelFarm/PaintLab.RenderTree.TextSurface/1.3_Layer/1_EditableTextFlowLayer.cs
@@ -19,7 +19,7 @@
             _defaultLineHeight = 24;//temp
             _ownerTextEditRenderBox = owner;

-
+
             //start with single line per layer
             //and can be changed to multiline
             _lineCollection = new EditableTextLine(this); //TODO review here
@@ -406,6 +406,15 @@
 #endif
         }

+        public int Bottom
+        {
+            //get bottom
+            get
+            {
+                EditableTextLine lastLine = GetTextLine(this.LineCount - 1);
+                return (lastLine != null) ? lastLine.Top + lastLine.ActualLineHeight : DefaultLineHeight;
+            }
+        }

         internal EditableTextLine GetTextLine(int lineId)
         {


port fix for 42231

port fix for 42231

--- src/System.Net.Security/tests/FunctionalTests/CertificateValidationRemoteServer.cs
+++ src/System.Net.Security/tests/FunctionalTests/CertificateValidationRemoteServer.cs
@@ -16,6 +16,7 @@
     public class CertificateValidationRemoteServer
     {
         [Fact]
+        [OuterLoop("Uses external servers")]
         public async Task CertificateValidationRemoteServer_EndToEnd_Ok()
         {
             using (var client = new TcpClient(AddressFamily.InterNetwork))


revert change

revert change

--- src/Umbraco.Web/PropertyEditors/ValueConverters/NestedContentManyValueConverter.cs
+++ src/Umbraco.Web/PropertyEditors/ValueConverters/NestedContentManyValueConverter.cs
@@ -60,7 +60,7 @@
                 var configuration = propertyType.DataType.ConfigurationAs<NestedContentConfiguration>();
                 var contentTypes = configuration.ContentTypes;
                 var elements = contentTypes.Length == 1
-                    ? PublishedModelFactory.CreateModelList(contentTypes[0].Key)
+                    ? PublishedModelFactory.CreateModelList(contentTypes[0].Alias)
                     : new List<IPublishedElement>();

                 var value = (string)inter;


Maui sample works for ISample samples

Maui sample works for ISample samples

--- Samples/Mapsui.Samples.Maui/MainPage.cs
+++ Samples/Mapsui.Samples.Maui/MainPage.cs
@@ -76,19 +76,19 @@
             {
                 WidthRequest = 200,

-            }.Bind(Label.TextProperty, nameof(IMapControlSample.Name))
+            }.Bind(Label.TextProperty, nameof(ISample.Name))
         };
     }

-    private void CollectionView_SelectionChanged(object? sender, SelectionChangedEventArgs e)
+    private async void CollectionView_SelectionChanged(object? sender, SelectionChangedEventArgs e)
     {
         if (e.CurrentSelection == null)
         {
             return;
         }

-        var sample = (IMapControlSample)e.CurrentSelection[0];
-        sample.Setup(mapControl);
+        var sample = (ISample)e.CurrentSelection[0];
+        mapControl.Map = await sample.CreateMapAsync();
     }

     private void categoryPicker_SelectedIndexChanged(object? sender, EventArgs e)


[Sandbox] Default interpreter to PythonInterpreter

--- Samples/Sandbox.MonoGame/SandboxGame.cs
+++ Samples/Sandbox.MonoGame/SandboxGame.cs
@@ -95,7 +95,7 @@
             _cube = new Cube(GraphicsDevice, _effect);

             // Set console's font and interpreter.
-            _console.LoadContent(_arial, _roslynInterpreter);
+            _console.LoadContent(_arial, _pythonInterpreter);
             _console.BackgroundTexture = Content.Load<Texture2D>("console");

             // Register variables and types of interest with the Python interpreter.


Don't instantiate workspace service directly

--- src/Workspaces/Core/Portable/LinkedFileDiffMerging/LinkedFileDiffMergingSession.cs
+++ src/Workspaces/Core/Portable/LinkedFileDiffMerging/LinkedFileDiffMergingSession.cs
@@ -85,7 +85,7 @@

             // Automatically merge non-conflicting diffs while collecting the conflicting diffs

-            var textDifferencingService = _oldSolution.Workspace.Services.GetService<IDocumentTextDifferencingService>() ?? new DefaultDocumentTextDifferencingService();
+            var textDifferencingService = _oldSolution.Workspace.Services.GetRequiredService<IDocumentTextDifferencingService>();
             var appliedChanges = await textDifferencingService.GetTextChangesAsync(_oldSolution.GetDocument(linkedDocumentGroup.First()), _newSolution.GetDocument(linkedDocumentGroup.First()), cancellationToken).ConfigureAwait(false);
             var unmergedChanges = new List<UnmergedDocumentChanges>();


Treat nested type tokens as type tokens, too

--- Scripting/Compiler/Bundling/CopyBody.cs
+++ Scripting/Compiler/Bundling/CopyBody.cs
@@ -117,7 +117,7 @@
                     }
                     else if(Info.MemberType == MemberTypes.Method)
                         Gen.Emit(Code, GrabMethod(Info as MethodInfo));
-                    else if(Info.MemberType == MemberTypes.TypeInfo)
+                    else if(Info.MemberType == MemberTypes.TypeInfo || Info.MemberType == MemberTypes.NestedType)
                         Gen.Emit(Code, GrabType(Info as Type));
                     else throw new InvalidOperationException("Inline token is neither field, nor method, nor type");

@@ -156,7 +156,7 @@
                 // Argument is a 32-bit integer
                 case OperandType.InlineBrTarget:
                 case OperandType.InlineI:
-                case OperandType.ShortInlineR: // This is actually a float, but we don't care
+                case OperandType.ShortInlineR: // This is actually a 32-bit float, but we don't care
                 {
                     Gen.Emit(Code, BitHelper.ReadInteger(Bytes, ref i));
                     break;
@@ -169,7 +169,7 @@
                     break;
                 }

-                // Argument is a 32-bit float
+                // Argument is a 64-bit float
                 case OperandType.InlineR:
                 {
                     Gen.Emit(Code, BitHelper.ReadDouble(Bytes, ref i));


Simplify code.

Simplify code.

--- src/Workspaces/Core/Portable/Shared/Extensions/ICodeDefinitionFactoryExtensions.cs
+++ src/Workspaces/Core/Portable/Shared/Extensions/ICodeDefinitionFactoryExtensions.cs
@@ -232,16 +232,12 @@
             else if (overriddenProperty.IsIndexer() && document.Project.Language == LanguageNames.CSharp)
             {
                 // Indexer: return or set base[]. Only in C#, since VB must refer to these by name.
-                var body = codeFactory.ElementAccessExpression(
-                    codeFactory.BaseExpression(),
-                    codeFactory.CreateArguments(overriddenProperty.Parameters));
-
-                if (overriddenProperty.ReturnsByRef)
-                {
-                    body = codeFactory.RefExpression(body);
-                }
-
-                getBody = codeFactory.ReturnStatement(body);
+
+                getBody = codeFactory.ReturnStatement(
+                    WrapWithRefIfNecessary(codeFactory, overriddenProperty,
+                        codeFactory.ElementAccessExpression(
+                            codeFactory.BaseExpression(),
+                            codeFactory.CreateArguments(overriddenProperty.Parameters))));

                 setBody = codeFactory.ExpressionStatement(
                     codeFactory.AssignmentStatement(
@@ -280,17 +276,13 @@
                 }
                 else
                 {
-                    var body = codeFactory.InvocationExpression(
-                        codeFactory.MemberAccessExpression(
-                            codeFactory.BaseExpression(),
-                            codeFactory.IdentifierName(overriddenProperty.Name)), codeFactory.CreateArguments(overriddenProperty.Parameters));
-
-                    if (overriddenProperty.ReturnsByRef)
-                    {
-                        body = codeFactory.RefExpression(body);
-                    }
-
-                    getBody = codeFactory.ReturnStatement(body);
+                    getBody = codeFactory.ReturnStatement(
+                        WrapWithRefIfNecessary(codeFactory, overriddenProperty,
+                            codeFactory.InvocationExpression(
+                                codeFactory.MemberAccessExpression(
+                                    codeFactory.BaseExpression(),
+                                    codeFactory.IdentifierName(overriddenProperty.Name)), codeFactory.CreateArguments(overriddenProperty.Parameters))));
+
                     setBody = codeFactory.ExpressionStatement(
                         codeFactory.AssignmentStatement(
                             codeFactory.InvocationExpression(
@@ -303,16 +295,13 @@
             else
             {
                 // Regular property: return or set the base property
-                var body = codeFactory.MemberAccessExpression(
-                    codeFactory.BaseExpression(),
-                    codeFactory.IdentifierName(overriddenProperty.Name));
-
-                if (overriddenProperty.ReturnsByRef)
-                {
-                    body = codeFactory.RefExpression(body);
-                }
-
-                getBody = codeFactory.ReturnStatement(body);
+
+                getBody = codeFactory.ReturnStatement(
+                    WrapWithRefIfNecessary(codeFactory, overriddenProperty,
+                        codeFactory.MemberAccessExpression(
+                            codeFactory.BaseExpression(),
+                            codeFactory.IdentifierName(overriddenProperty.Name))));
+
                 setBody = codeFactory.ExpressionStatement(
                     codeFactory.AssignmentStatement(
                         codeFactory.MemberAccessExpression(
@@ -355,6 +344,11 @@
                 setMethod: accessorSet);
         }

+        private static SyntaxNode WrapWithRefIfNecessary(SyntaxGenerator codeFactory, IPropertySymbol overriddenProperty, SyntaxNode body)
+            => overriddenProperty.ReturnsByRef
+                ? codeFactory.RefExpression(body)
+                : body;
+
         public static IEventSymbol OverrideEvent(
             this SyntaxGenerator codeFactory,
             IEventSymbol overriddenEvent,


[Upd] Corrected filename

[Upd] Corrected filename

--- Sources/IniConfigurationSource.cs
+++ Sources/IniConfigurationSource.cs
@@ -32,7 +32,7 @@
         {
             if (!base.DesignMode && this.settings == null)
             {
-                Trace.TraceInformation("Loading configuration from " + this.settings.FileName);
+                Trace.TraceInformation("Loading configuration from " + this.iniName);
                 this.settings = new Settings(this.iniName, Settings.Format.IniFormat);
                 Trace.TraceInformation("File loaded " + this.settings.FileName);
             }


Remove some string handling in struct

Remove some string handling in struct

--- Src/IronPython.Modules/_struct.cs
+++ Src/IronPython.Modules/_struct.cs
@@ -1059,28 +1059,21 @@
             throw Error(context, "expected bool value got " + val.ToString());
         }

-        internal static char GetCharValue(CodeContext/*!*/ context, int index, object[] args) {
-            object val = GetValue(context, index, args);
-            if (val is string strVal && strVal.Length == 1) return strVal[0];
-            if (val is IList<byte> byteVal && byteVal.Count == 1) return (char)byteVal[0];
+        internal static byte GetCharValue(CodeContext/*!*/ context, int index, object[] args) {
+            object val = GetValue(context, index, args);
+            if (val is IList<byte> byteVal && byteVal.Count == 1) return byteVal[0];
             throw Error(context, "char format requires string of length 1");
         }

         internal static sbyte GetSByteValue(CodeContext/*!*/ context, int index, object[] args) {
             object val = GetValue(context, index, args);
-            if (Converter.TryConvertToSByte(val, out sbyte res)) {
-                return res;
-            }
+            if (Converter.TryConvertToSByte(val, out sbyte res)) return res;
             throw Error(context, "expected sbyte value got " + val.ToString());
         }

         internal static byte GetByteValue(CodeContext/*!*/ context, int index, object[] args) {
             object val = GetValue(context, index, args);
-
             if (Converter.TryConvertToByte(val, out byte res)) return res;
-
-            if (Converter.TryConvertToChar(val, out char cres)) return (byte)cres;
-
             throw Error(context, "expected byte value got " + val.ToString());
         }


[update]メイン画面で色が変わってなかったので変わるように

[update]メイン画面で色が変わってなかったので変わるように

--- Src/KIBOTTER/KIBOTTER/MainForm.cs
+++ Src/KIBOTTER/KIBOTTER/MainForm.cs
@@ -111,6 +111,7 @@
             AboutToolStripMenuItem.BackColor = Color.FromArgb(45, 45, 45);
             HelpToolStripMenuItem.BackColor = Color.FromArgb(45, 45, 45);
             AddAccountToolStripMenuItem.BackColor = Color.FromArgb(45, 45, 45);
+            ScheduleToolStripMenuItem.BackColor = Color.FromArgb(45, 45, 45);
             CloseToolStripMenuItem.BackColor = Color.FromArgb(45, 45, 45);
             MorseToolStripMenuItem.BackColor = Color.FromArgb(45, 45, 45);
             SushiModeToolStripMenuItem.BackColor = Color.FromArgb(45, 45, 45);
@@ -121,6 +122,7 @@
             AboutToolStripMenuItem.ForeColor = Color.White;
             HelpToolStripMenuItem.ForeColor = Color.White;
             AddAccountToolStripMenuItem.ForeColor = Color.White;
+            ScheduleToolStripMenuItem.ForeColor = Color.White;
             CloseToolStripMenuItem.ForeColor = Color.White;
             MorseToolStripMenuItem.ForeColor = Color.White;
             SushiModeToolStripMenuItem.ForeColor = Color.White;
@@ -158,6 +160,7 @@
             AboutToolStripMenuItem.BackColor = SystemColors.Control;
             HelpToolStripMenuItem.BackColor = SystemColors.Control;
             AddAccountToolStripMenuItem.BackColor = SystemColors.Control;
+            ScheduleToolStripMenuItem.BackColor = SystemColors.Control;
             CloseToolStripMenuItem.BackColor = SystemColors.Control;
             MorseToolStripMenuItem.BackColor = SystemColors.Control;
             SushiModeToolStripMenuItem.BackColor = SystemColors.Control;
@@ -168,6 +171,7 @@
             AboutToolStripMenuItem.ForeColor = SystemColors.ControlText;
             HelpToolStripMenuItem.ForeColor = SystemColors.ControlText;
             AddAccountToolStripMenuItem.ForeColor = SystemColors.ControlText;
+            ScheduleToolStripMenuItem.ForeColor = SystemColors.ControlText;
             CloseToolStripMenuItem.ForeColor = SystemColors.ControlText;
             MorseToolStripMenuItem.ForeColor = SystemColors.ControlText;
             SushiModeToolStripMenuItem.ForeColor = SystemColors.ControlText;


Fix incorrect reference assembly path

Fix incorrect reference assembly path

--- Resolution/DotNetReferenceAssembliesPathResolver.cs
+++ Resolution/DotNetReferenceAssembliesPathResolver.cs
@@ -38,9 +38,9 @@
             }

             if (os == Platform.Darwin &&
-                fileSystem.Directory.Exists("/Library/Framework/Mono.Framework/Versions/Current/lib/mono/xbuild-frameworks"))
+                fileSystem.Directory.Exists("/Library/Frameworks/Mono.framework/Versions/Current/lib/mono/xbuild-frameworks"))
             {
-                return "/Library/Framework/Mono.Framework/Versions/Current/lib/mono/xbuild-frameworks";
+                return "/Library/Frameworks/Mono.framework/Versions/Current/lib/mono/xbuild-frameworks";
             }

             if (fileSystem.Directory.Exists("/usr/local/lib/mono/xbuild-frameworks"))
@@ -56,4 +56,4 @@
             return null;
         }
     }
-}+}


Resolved an issue with SpatialEvaluations PostSetup(), so it now correctly sets the boundingbox reference

--- Runtime/Prototyping/Evaluation/SpatialEvaluation.cs
+++ Runtime/Prototyping/Evaluation/SpatialEvaluation.cs
@@ -1,6 +1,6 @@
 using UnityEngine;
 using System.Collections.Generic;
-using droid.Runtime.Utilities.GameObjects.BoundingBoxes;
+using droid.Runtime.GameObjects.BoundingBoxes;

 namespace droid.Runtime.Prototyping.Evaluation
 {
@@ -19,7 +19,9 @@
         public new virtual void PostSetup()
         {
             base.PostSetup();
-            gameObject.GetComponent<BoundingBox>();
+
+            if(boundingBox == null)
+                boundingBox = gameObject.GetComponent<BoundingBox>();
         }

         /// <summary>


Avoid failing when a Channel.Dispose race condition occurs

Stabilizes DisposeChannel_WhileRemoteEndIsTransmitting test

--- src/Nerdbank.Streams/MultiplexingStream.cs
+++ src/Nerdbank.Streams/MultiplexingStream.cs
@@ -825,8 +825,17 @@
                 this.TraceSource.TraceData(TraceEventType.Verbose, (int)TraceEventId.FrameReceivedPayload, payload);
             }

-            // This API won't throw at us even if the PipeWriter has been completed (per current corefx implementation anyway).
-            writer.Advance(header.FramePayloadLength);
+            try
+            {
+                writer.Advance(header.FramePayloadLength);
+            }
+            catch (InvalidOperationException)
+            {
+                // Despite corefx source code suggesting otherwise, this API *does* sometimes throw InvalidOperationException when the writer is completed.
+                // Maybe it's because there are alternative PipeWriter implementations out there, but this caused indeterministic failures
+                // in our unit tests.
+                return;
+            }

             var flushResult = await writer.FlushAsync(cancellationToken).ConfigureAwait(false);
             if (flushResult.IsCanceled)


Rename method

Rename method

--HG--
branch : dev

--- src/Orchard/Environment/IAssemblyLoader.cs
+++ src/Orchard/Environment/IAssemblyLoader.cs
@@ -36,13 +36,13 @@

             // Try loading with full name first (if there is a full name)
             if (fullName != shortName) {
-                result = LookupFusion(shortName);
+                result = TryAssemblyLoad(fullName);
                 if (result != null)
                     return result;
             }

             // Try loading with short name
-            result = LookupFusion(shortName);
+            result = TryAssemblyLoad(shortName);
             if (result != null)
                 return result;

@@ -56,7 +56,7 @@
             return Assembly.Load(fullName);
         }

-        private static Assembly LookupFusion(string name) {
+        private static Assembly TryAssemblyLoad(string name) {
             try {
                 return Assembly.Load(name);
             }


Cleaned up, added comments

Cleaned up, added comments

--- SampleWpfApplicationTests/MainWindowBindingTests.cs
+++ SampleWpfApplicationTests/MainWindowBindingTests.cs
@@ -19,31 +19,35 @@
         public void MainWindows_HasNoBindingError()
         {
             // NB: this test must fail !
-            // it's the goal of this project: to show that we can raise exceptions
+            // it's the goal of this project: to show that we can
+            // detect binding errors in a unit test

             using( var listener = new BindingErrorListener())
             {
                 listener.ErrorCatched += msg => Assert.Fail(msg);

-                var win = new MainWindow();
+                AssertDoesNotThrow(() => new MainWindow());
             }
         }

         static MainWindowBindingTests()
         {
-            var dictUri = new Uri("/SampleWpfApplication;component/Resources.xaml", UriKind.Relative);
-            var dict = Application.LoadComponent(dictUri) as ResourceDictionary;
+            // Load the resources required to create MainWindow
+            // (in this case, we need ViewModelLocator)
+            // The trick is to move resources into a dedicated file, instead of App.xaml
+
+            var resourcesUri = new Uri("/SampleWpfApplication;component/Resources.xaml", UriKind.Relative);
+            var resources = Application.LoadComponent(resourcesUri) as ResourceDictionary;

             var app = new Application();
-            app.Resources.MergedDictionaries.Add(dict);
+            app.Resources.MergedDictionaries.Add(resources);
         }

-        static void AssertDoesNotThrow<T>(Func<T> func)
+        static void AssertDoesNotThrow(Action action)
         {
-            T value;
             try
             {
-                value = func();
+                action();
             }
             catch(Exception e)
             {


add method to interface

add method to interface

--- Sangmado.Fida.Http/HttpClient/IEncodedHttpClient.cs
+++ Sangmado.Fida.Http/HttpClient/IEncodedHttpClient.cs
@@ -1,4 +1,6 @@
-namespace Sangmado.Fida.Http
+using System.Net;
+
+namespace Sangmado.Fida.Http
 {
     public interface IEncodedHttpClient
     {
@@ -11,9 +13,13 @@
         T PutEncoded<T>(string requestUri, byte[] content);

         void Post(string requestUri, object content);
+        void Post(string url, object content, out HttpStatusCode statusCode);
         T Post<T>(string requestUri, object content);
+        T Post<T>(string url, object content, out HttpStatusCode statusCode);

         void PostEncoded(string requestUri, byte[] content);
+        void PostEncoded(string url, byte[] content, out HttpStatusCode statusCode);
         T PostEncoded<T>(string requestUri, byte[] content);
+        T PostEncoded<T>(string url, byte[] content, out HttpStatusCode statusCode);
     }
 }


[XCode] Readability improvement: use auto properties in more classes

--- Sharpmake.Generators/Apple/XCodeProj.cs
+++ Sharpmake.Generators/Apple/XCodeProj.cs
@@ -1453,24 +1453,20 @@

         private class ProjectReference : ProjectFile
         {
-            private string _projectName;
-
             public ProjectReference(string fullPath)
                 : base(fullPath)
             {
-                _projectName = Name.Substring(0, Name.LastIndexOf('.'));
-            }
-
-
+                ProjectName = Name.Substring(0, Name.LastIndexOf('.'));
+            }

             public ProjectReference(ItemSection itemSection, string identifier)
                 : base(ItemSection.PBXProject, identifier)
             {
-                _projectName = identifier;
+                ProjectName = identifier;
             }

             public override SourceTreeSetting SourceTreeValue { get { return SourceTreeSetting.SOURCE_ROOT; } }
-            public string ProjectName { get { return _projectName; } }
+            public string ProjectName { get; }
         }

         private class ProjectOutputFile : ProjectFile
@@ -1623,28 +1619,22 @@

         private class ProjectBuildFile : ProjectItem
         {
-            private ProjectFileBase _file;
-
             public ProjectBuildFile(ProjectFileBase file) : base(ItemSection.PBXBuildFile, file.Name)
             {
-                _file = file;
-            }
-
-            public ProjectFileBase File { get { return _file; } }
+                File = file;
+            }
+
+            public ProjectFileBase File { get; }
         }

         private abstract class ProjectBuildPhase : ProjectItem
         {
-            private readonly List<ProjectBuildFile> _files;
-            private uint _buildActionMask = 0;
-            private int _runOnlyForDeploymentPostprocessing;
-
             public ProjectBuildPhase(ItemSection section, string phaseName, uint buildActionMask)
                 : base(section, phaseName)
             {
-                _files = new List<ProjectBuildFile>();
-                _buildActionMask = buildActionMask;
-                _runOnlyForDeploymentPostprocessing = 0;
+                Files = new List<ProjectBuildFile>();
+                BuildActionMask = buildActionMask;
+                RunOnlyForDeploymentPostprocessing = 0;
             }

             public override void GetAdditionalResolverParameters(ProjectItem item, Resolver resolver, ref Dictionary<string, string> resolverParameters)
@@ -1662,9 +1652,9 @@
                 resolverParameters.Add("itemChildren", childrenList);
             }

-            public List<ProjectBuildFile> Files { get { return _files; } }
-            public uint BuildActionMask { get { return _buildActionMask; } }
-            public int RunOnlyForDeploymentPostprocessing { get { return _runOnlyForDeploymentPostprocessing; } }
+            public List<ProjectBuildFile> Files { get; }
+            public uint BuildActionMask { get; } = 0;
+            public int RunOnlyForDeploymentPostprocessing { get; }
         }

         private class ProjectResourcesBuildPhase : ProjectBuildPhase
@@ -1849,32 +1839,27 @@

         private class ProjectBuildConfiguration : ProjectItem
         {
-            private Project.Configuration _configuration;
-            private XCodeOptions _options;
-
             public ProjectBuildConfiguration(ItemSection section, string configurationName, Project.Configuration configuration, XCodeOptions options)
                 : base(section, configurationName)
             {
-                _configuration = configuration;
-                _options = options;
-            }
-
-            public XCodeOptions Options { get { return _options; } }
-            public Project.Configuration Configuration { get { return _configuration; } }
-            public string Optimization { get { return _configuration.Target.Name; } }
+                Configuration = configuration;
+                Options = options;
+            }
+
+            public XCodeOptions Options { get; }
+            public Project.Configuration Configuration { get; }
+            public string Optimization { get { return Configuration.Target.Name; } }
         }

         private class ProjectBuildConfigurationForTarget : ProjectBuildConfiguration
         {
-            private ProjectNativeTarget _nativeTarget;
-
             public ProjectBuildConfigurationForTarget(ItemSection section, Project.Configuration configuration, ProjectNativeTarget nativeTarget, XCodeOptions options)
                 : base(section, configuration.Target.Name, configuration, options)
             {
-                _nativeTarget = nativeTarget;
-            }
-
-            public ProjectNativeTarget NativeTarget { get { return _nativeTarget; } }
+                NativeTarget = nativeTarget;
+            }
+
+            public ProjectNativeTarget NativeTarget { get; }
         }

         private class ProjectBuildConfigurationForNativeTarget : ProjectBuildConfigurationForTarget


cleaned singleton main

cleaned singleton main

--- src/Pattern-Catalogue/Singleton/Program.cs
+++ src/Pattern-Catalogue/Singleton/Program.cs
@@ -10,20 +10,15 @@
     {
         static void Main(string[] args)
         {
-            Console.WriteLine("Attempting to get Singlton instance one");
+            Console.WriteLine("Proofe Singleton does not get instantiated instantly.");
             Singleton v1 = Singleton.Instance;
-            Console.WriteLine("Attempting to get Singlton instance two");
             Singleton v2 = Singleton.Instance;
-            Console.WriteLine("\n*** As it can be seen, the instance gets created (= constructor executes) lazily only when Singleton class is accessed the first time. \n*** Both static and private constructor are executed once. As we access main Singleton class we cause execution of the private constructor. Singleton class holds a instance of itself so static constructor gets call the second time.");
-
-            Console.WriteLine("Compare both instances: "+v1.Equals(v2));
-
-            Console.WriteLine("\nSet both instances to null");
+
             v1 = null;
             v2 = null;
-            Console.WriteLine("Attempting to get Singlton instance three");
+
             Singleton v3 = Singleton.Instance;
-            Console.WriteLine("\n*** No constructor execution happens.\n*** The static instance does not get deleted even when we remove both the objects referring to it");
+
             Console.ReadLine();
         }
     }


1.2.0.2

--- SharprWowApi/Properties/AssemblyInfo.cs
+++ SharprWowApi/Properties/AssemblyInfo.cs
@@ -32,5 +32,5 @@
 // You can specify all the values or you can default the Build and Revision Numbers
 // by using the '*' as shown below:
 // [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.1.0.1")]
-[assembly: AssemblyFileVersion("1.1.0.1")]
+[assembly: AssemblyVersion("1.1.0.2")]
+[assembly: AssemblyFileVersion("1.1.0.2")]


Changing ProductVariant.InventoryQuantity from int to long

--- ShopifySharp/Entities/ProductVariant.cs
+++ ShopifySharp/Entities/ProductVariant.cs
@@ -131,7 +131,7 @@
         /// NOTE: After 2018-07-01, this field will be read-only in the Shopify API. Use the `InventoryLevelService` instead.
         /// </summary>
         [JsonProperty("inventory_quantity")]
-        public int? InventoryQuantity { get; set; }
+        public long? InventoryQuantity { get; set; }

         /// <summary>
         /// The unique numeric identifier for one of the product's images.


fix TryFindPropertyInfo for properties with name 'Item'

--- Signum.Entities/Reflection/Reflector.cs
+++ Signum.Entities/Reflection/Reflector.cs
@@ -278,7 +278,7 @@

             var propertyName = PropertyName(fi.Name);

-            var result = fi.DeclaringType.GetProperty(propertyName, flags);
+            var result = fi.DeclaringType.GetProperty(propertyName, flags, null, null, new Type[0], null);

             if (result != null)
                 return result;


Update LocalizationEx.cs (#420)

Update LocalizationEx.cs (#420)

Corrected language name Portoguese -> Portuguese.

--- SimpleDnsCrypt/Helper/LocalizationEx.cs
+++ SimpleDnsCrypt/Helper/LocalizationEx.cs
@@ -55,8 +55,8 @@
 				//new Language {Name = "Norwegian", ShortCode = "no", CultureCode = "no-NO"},
 				new Language {Name = "Persian", ShortCode = "fa", CultureCode = "fa-FA"},
 				new Language {Name = "Polish", ShortCode = "pl", CultureCode = "pl-PL"},
-				new Language {Name = "Portoguese", ShortCode = "pt", CultureCode = "pt-PT"},
-				new Language {Name = "Portoguese (Brasil)", ShortCode = "pt-br", CultureCode = "pt-BR"},
+				new Language {Name = "Portuguese", ShortCode = "pt", CultureCode = "pt-PT"},
+				new Language {Name = "Portuguese (Brasil)", ShortCode = "pt-br", CultureCode = "pt-BR"},
 				new Language {Name = "Romanian", ShortCode = "ro", CultureCode = "ro-RO"},
 				new Language {Name = "Russian", ShortCode = "ru", CultureCode = "ru-RU"},
 				new Language {Name = "Spanish", ShortCode = "es", CultureCode = "es-ES"},


improve error message in SchemaBuilder

improve error message in SchemaBuilder

--- Signum.Engine/Schema/SchemaBuilder/SchemaBuilder.cs
+++ Signum.Engine/Schema/SchemaBuilder/SchemaBuilder.cs
@@ -233,27 +233,29 @@
             using (HeavyProfiler.LogNoStackTrace("Include", () => type.TypeName()))
             {
                 if (type.IsAbstract)
-                    throw new InvalidOperationException(route?.Let(r => "Error on field {0}: ".FormatWith(r)) + "Impossible to include in the Schema the type {0} because is abstract".FormatWith(type));
+                    throw new InvalidOperationException(ErrorIncluding(route) + $"Impossible to include in the Schema the type {type} because is abstract");

                 if (!Reflector.IsEntity(type))
-                    throw new InvalidOperationException(route?.Let(r => "Error on field {0}: ".FormatWith(r)) + "Impossible to include in the Schema the type {0} because is not and Entity".FormatWith(type));
+                    throw new InvalidOperationException(ErrorIncluding(route) + $"Impossible to include in the Schema the type {type} because is not and Entity");

                 foreach (var t in type.Follow(a => a.BaseType))
                     if (!t.IsSerializable)
-                        throw new InvalidOperationException("Type {0} is not marked as serializable".FormatWith(t.TypeName()));
-
-                string name = schema.Settings.desambiguatedNames?.TryGetC(type) ?? Reflector.CleanTypeName(EnumEntity.Extract(type) ?? type);
-
-                if (schema.NameToType.ContainsKey(name))
-                    throw new InvalidOperationException(route?.Let(r => "Error on field {0}: ".FormatWith(r)) + "Two types have the same cleanName, desambiguate using Schema.Current.Settings.Desambiguate method: \r\n {0}\r\n {1}".FormatWith(schema.NameToType[name].FullName, type.FullName));
+                        throw new InvalidOperationException(ErrorIncluding(route) + $"Type {t.TypeName()} is not marked as serializable");
+
+                string cleanName = schema.Settings.desambiguatedNames?.TryGetC(type) ?? Reflector.CleanTypeName(EnumEntity.Extract(type) ?? type);
+
+                if (schema.NameToType.ContainsKey(cleanName))
+                    throw new InvalidOperationException(ErrorIncluding(route) + @$"Two types have the same cleanName '{cleanName}', desambiguate using Schema.Current.Settings.Desambiguate method:
+{schema.NameToType[cleanName].FullName}
+{type.FullName}");

                 try
                 {
                     result = new Table(type);

                     schema.Tables.Add(type, result);
-                    schema.NameToType[name] = type;
-                    schema.TypeToName[type] = name;
+                    schema.NameToType[cleanName] = type;
+                    schema.TypeToName[type] = cleanName;

                     Complete(result);

@@ -262,11 +264,16 @@
                 catch (Exception) //Avoid half-cooked tables
                 {
                     schema.Tables.Remove(type);
-                    schema.NameToType.Remove(name);
+                    schema.NameToType.Remove(cleanName);
                     schema.TypeToName.Remove(type);
                     throw;
                 }
             }
+        }
+
+        private static string? ErrorIncluding(PropertyRoute? route)
+        {
+            return route?.Let(r => $"Error including {r}: ");
         }

         void Complete(Table table)


Add memory mapped file support to PhysicalIOProvider

--- SkyEditor.Core/IO/PhysicalIOProvider.cs
+++ SkyEditor.Core/IO/PhysicalIOProvider.cs
@@ -1,6 +1,7 @@
 using System;
 using System.Collections.Generic;
 using System.IO;
+using System.IO.MemoryMappedFiles;
 using System.Text;

 namespace SkyEditor.Core.IO
@@ -8,7 +9,7 @@
     /// <summary>
     /// Implementation of <see cref="IIOProvider"/> that wraps <see cref="System.IO.File"/> and <see cref="System.IO.Directory"/> (i.e. the physical file system).
     /// </summary>
-    public class PhysicalIOProvider : IIOProvider
+    public class PhysicalIOProvider : IIOProvider, IMemoryMappedIOProvider
     {

         public PhysicalIOProvider()
@@ -175,5 +176,10 @@
         {
             return File.ReadAllText(FixPath(filename));
         }
+
+        public MemoryMappedFile OpenMemoryMappedFile(string filename)
+        {
+            return MemoryMappedFile.CreateFromFile(filename);
+        }
     }
 }


fix EmailTemplate import from XML

fix EmailTemplate import from XML

--- Signum.Entities.Extensions/Mailing/EmailTemplate.cs
+++ Signum.Entities.Extensions/Mailing/EmailTemplate.cs
@@ -181,30 +181,31 @@

         IsBodyHtml = bool.Parse(element.Attribute("IsBodyHtml")!.Value);

-        From = element.Element("From")?.Let(from => new EmailTemplateFromEmbedded
-        {
-            DisplayName = from.Attribute("DisplayName")?.Value,
-            EmailAddress = from.Attribute("EmailAddress")?.Value,
-            Token = from.Attribute("Token")?.Let(t => new QueryTokenEmbedded(t.Value)),
-            WhenMany = from.Attribute("WhenMany")?.Value.ToEnum<WhenManyFromBehaviour>() ?? WhenManyFromBehaviour.FistResult,
-            WhenNone = from.Attribute("WhenNone")?.Value.ToEnum<WhenNoneFromBehaviour>() ?? WhenNoneFromBehaviour.NoMessage,
+        From = From.CreateOrAssignEmbedded(element.Element("From"), (etf, xml) =>
+        {
+            etf.DisplayName = xml.Attribute("DisplayName")?.Value;
+            etf.EmailAddress = xml.Attribute("EmailAddress")?.Value;
+            etf.Token = xml.Attribute("Token")?.Let(t => new QueryTokenEmbedded(t.Value));
+            etf.WhenMany = xml.Attribute("WhenMany")?.Value.ToEnum<WhenManyFromBehaviour>() ?? WhenManyFromBehaviour.FistResult;
+            etf.WhenNone = xml.Attribute("WhenNone")?.Value.ToEnum<WhenNoneFromBehaviour>() ?? WhenNoneFromBehaviour.NoMessage;
         });

-        Recipients = element.Element("Recipients")!.Elements("Recipient").Select(rep => new EmailTemplateRecipientEmbedded
-        {
-            DisplayName = rep.Attribute("DisplayName")?.Value,
-            EmailAddress = rep.Attribute("EmailAddress")?.Value,
-            Kind = rep.Attribute("Kind")!.Value.ToEnum<EmailRecipientKind>(),
-            Token = rep.Attribute("Token")?.Let(a => new QueryTokenEmbedded(a.Value)),
-            WhenMany = rep.Attribute("WhenMany")?.Value?.ToEnum<WhenManyRecipiensBehaviour>() ?? WhenManyRecipiensBehaviour.KeepOneMessageWithManyRecipients,
-            WhenNone = rep.Attribute("WhenNone")?.Value?.ToEnum<WhenNoneRecipientsBehaviour>() ?? WhenNoneRecipientsBehaviour.ThrowException,
-        }).ToMList();
-
-        Messages = element.Element("Messages")!.Elements("Message").Select(elem => new EmailTemplateMessageEmbedded(ctx.GetCultureInfoEntity(elem.Attribute("CultureInfo")!.Value))
-        {
-            Subject = elem.Attribute("Subject")!.Value,
-            Text = elem.Value
-        }).ToMList();
+        Recipients.Synchronize(element.Element("Recipients")!.Elements("Recipient").ToList(), (rep, xml) =>
+        {
+            rep.DisplayName = xml.Attribute("DisplayName")?.Value;
+            rep.EmailAddress = xml.Attribute("EmailAddress")?.Value;
+            rep.Kind = xml.Attribute("Kind")!.Value.ToEnum<EmailRecipientKind>();
+            rep.Token = xml.Attribute("Token")?.Let(a => new QueryTokenEmbedded(a.Value));
+            rep.WhenMany = xml.Attribute("WhenMany")?.Value?.ToEnum<WhenManyRecipiensBehaviour>() ?? WhenManyRecipiensBehaviour.KeepOneMessageWithManyRecipients;
+            rep.WhenNone = xml.Attribute("WhenNone")?.Value?.ToEnum<WhenNoneRecipientsBehaviour>() ?? WhenNoneRecipientsBehaviour.ThrowException;
+        });
+
+        Messages.Synchronize(element.Element("Messages")!.Elements("Message").ToList(), (et, xml) =>
+        {
+            et.CultureInfo = ctx.GetCultureInfoEntity(xml.Attribute("CultureInfo")!.Value);
+            et.Subject = xml.Attribute("Subject")!.Value;
+            et.Text = xml.Value;
+        });

         Attachments.SynchronizeAttachments(element.Element("Attachments")?.Elements().ToList(), ctx, this);

@@ -301,7 +302,7 @@

 public class EmailTemplateMessageEmbedded : EmbeddedEntity
 {
-    private EmailTemplateMessageEmbedded() { }
+    public EmailTemplateMessageEmbedded() { }

     public EmailTemplateMessageEmbedded(CultureInfoEntity culture)
     {


commit

commit

--- SmartCardApi/Properties/AssemblyInfo.cs
+++ SmartCardApi/Properties/AssemblyInfo.cs
@@ -32,5 +32,5 @@
 // You can specify all the values or you can default the Build and Revision Numbers
 // by using the '*' as shown below:
 // [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.4.54.0")]
-[assembly: AssemblyFileVersion("1.4.54.0")]
+[assembly: AssemblyVersion("1.4.55.0")]
+[assembly: AssemblyFileVersion("1.4.55.0")]


Fixed a bug when replacing a file with a smaller size.

--- SmartSync.Common/Actions/ReplaceFile.cs
+++ SmartSync.Common/Actions/ReplaceFile.cs
@@ -22,7 +22,10 @@
         {
             using (Stream sourceStream = Source.Open(FileAccess.Read))
             using (Stream destinationStream = Destination.Open(FileAccess.Write))
+            {
+                destinationStream.SetLength(sourceStream.Length);
                 sourceStream.CopyTo(destinationStream);
+            }

             Destination.Date = Source.Date;
         }