Use the correct trigger

Use the correct trigger

--- GenerateMCFiles/VpionBetaGenerator.cs
+++ GenerateMCFiles/VpionBetaGenerator.cs
@@ -31,8 +31,7 @@
                              let llp2 = evt.Data.LLPs[1]
                              select new VpionData
                              {
-                                 // TODO: Make sure from Rachel and Emma this is the right trigger - seems to be zero all the time.
-                                 PassedCalRatio = evt.Data.event_passCalRatio_cleanLLP_TAU60,
+                                 PassedCalRatio = evt.Data.event_passCalRatio_TAU60,
                                  vpi1_E = llp1.LLP_E,
                                  vpi1_eta = llp1.eta,
                                  vpi1_phi = llp1.phi,


BOMrotation file tryouts

BOMrotation file tryouts

--- GerberLibrary/Core/BillOfMaterials.cs
+++ GerberLibrary/Core/BillOfMaterials.cs
@@ -289,7 +289,7 @@
         public string AddBOMItemExt(string package, string device, string value, string refdes, BOMNumberSet set, string SourceBoard, double x, double y, double angle, BoardSide side = BoardSide.Top)
         {
             string ID = GetID(package, device, refdes);
-            return AddBOMItemInt(package, device, value, refdes, set, SourceBoard, x, y, angle + GetRotationOffset(ID), side);
+            return AddBOMItemInt(package, device, value, refdes, set, SourceBoard, x, y, angle , side);
         }

         string AddBOMItemInt(string package, string device, string value, string refdes, BOMNumberSet set, string SourceBoard, double x, double y, double angle, BoardSide side = BoardSide.Top)
@@ -1086,8 +1086,7 @@

                 foreach (var v in ds.Value.Values)
                 {
-
-                    OutlinesRotations.Add(String.Format("{0} {1}", v.Combined(), GetRotationOffset(v.Combined())));
+                    SetRotationOffset(v.Combined(), GetRotationOffset(v.Combined()));

                     string refdescs = "\""  + v.RefDes[0].NameOnBoard;
                     for (int i = 1; i < v.RefDes.Count; i++)
@@ -1121,7 +1120,7 @@
                         p.x.ToString().Replace(",", ".") + "mm",
                         p.y.ToString().Replace(",", ".") + "mm",
                         p.Side == BoardSide.Top ? "T" : "B",
-                           p.angle);
+                           (p.angle + 360 + GetRotationOffset(v.Combined()))%360);
                         outlinesPNP.Add(line);

                     }
@@ -1129,7 +1128,10 @@
             }

             File.WriteAllLines(BaseFolder + "\\" + Name + "_PNP.csv", outlinesPNP);
-
+            foreach(var a in RotationOffsets)
+            {
+                OutlinesRotations.Add(String.Format("{0} {1}", a.Key, a.Value));
+            }
             OutlinesRotations.Sort();
             File.WriteAllLines(DefaultRotationFile, OutlinesRotations);
         }
@@ -1141,9 +1143,15 @@
             return 0;

         }
-        public const string DefaultRotationFile = "RotationOffsets.txt";
-        public static void LoadRotationOffsets(string v = DefaultRotationFile)
-        {
+        public static void SetRotationOffset(string name,int off)
+        {
+            RotationOffsets[name] = off;
+        }
+
+        public static string DefaultRotationFile = "RotationOffsets.txt";
+        public static void LoadRotationOffsets(string v = "")
+        {
+            if (v.Length == 0) v = DefaultRotationFile; else DefaultRotationFile = v;
             Console.WriteLine("Loading rotations from {0}", Path.GetFullPath(v));
             try
             {


refs #46 Remove para tags in param tags :memo:

--- GeroMachine/GeroMachine/Transition.cs
+++ GeroMachine/GeroMachine/Transition.cs
@@ -25,11 +25,11 @@
 		/// <summary>
 		/// <see cref="Transition"/>クラスの新しいインスタンスを初期化する.
 		/// </summary>
-		/// <param name="nextState">遷移先の状態
-		/// <para>nullを指定すると, この遷移は内部遷移となる.(NotImplemented)</para></param>
-		/// <param name="transitionMethod">遷移時に実行する処理
-		/// <para><see cref="Execute"/>を実行したときに, ここで指定した処理が実行される.</para>
-		/// <para>実行する処理が無い場合は, nullを指定する.</para></param>
+		/// <param name="nextState">遷移先の状態.
+		/// nullを指定すると, この遷移は内部遷移となる.(NotImplemented)</param>
+		/// <param name="transitionMethod">遷移時に実行する処理.
+		/// <see cref="Execute"/>を実行したときに, ここで指定した処理が実行される.
+		/// 実行する処理が無い場合は, nullを指定する</param>
 		public Transition(State nextState, TransitionMethodDelegate transitionMethod)
 		{
 			if (nextState == null)


PG-1305 [WIP]: Fixed crash when saved mode was not a legal combination (not related to bug report, but I got this error in Sample project while investigating bug)

--- Glyssen/Dialogs/AssignCharacterDlg.cs
+++ Glyssen/Dialogs/AssignCharacterDlg.cs
@@ -113,7 +113,7 @@
 			}
 			else
 			{
-				if (m_viewModel.Mode == BlocksToDisplay.NotAlignedToReferenceText)
+				if ((m_viewModel.Mode | BlocksToDisplay.NotAlignedToReferenceText) > 0)
 					m_viewModel.SetMode(BlocksToDisplay.NotYetAssigned, false);
 				Debug.Assert(!m_toolStripButtonMatchReferenceText.Checked);
 				m_toolStripButtonMatchReferenceText.Enabled = false;
@@ -293,7 +293,14 @@
 				case BlocksToDisplay.NeedsReview: m_toolStripComboBoxFilter.SelectedIndex = 7; break;
 				case BlocksToDisplay.NotAlignedToReferenceText: m_toolStripComboBoxFilter.SelectedIndex = 8; break;
 				default:
-					throw new InvalidEnumArgumentException("mode", (int)mode, typeof(BlocksToDisplay));
+					if (mode == (BlocksToDisplay.ExcludeUserConfirmed | BlocksToDisplay.NotAlignedToReferenceText))
+					{
+						// Not sure how this happened, but maybe there was a historic way. I had this in my Sample project.
+						m_toolStripComboBoxFilter.SelectedIndex = m_toolStripComboBoxFilter.Items.Count > 8 ? 8 : 0;
+						break;
+					}
+					else
+						throw new InvalidEnumArgumentException("mode", (int)mode, typeof(BlocksToDisplay));
 			}
 		}


Rename `LogsFolder` property of `Log4NetConsumerTests` to `LogsDirectory`

--- test/Atata.Tests/Log4NetConsumerTests.cs
+++ test/Atata.Tests/Log4NetConsumerTests.cs
@@ -16,11 +16,11 @@
         private static FileInfo ConfigFileInfo =>
             new FileInfo(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "log4net.config"));

-        private static string LogsFolder =>
+        private static string LogsDirectory =>
             Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Logs", "Log4Net");

         private static string TraceLogFilePath =>
-            Path.Combine(LogsFolder, "Trace.log");
+            Path.Combine(LogsDirectory, "Trace.log");

         public override void TearDown()
         {
@@ -29,8 +29,8 @@
             foreach (var repository in log4net.LogManager.GetAllRepositories())
                 repository.Shutdown();

-            if (Directory.Exists(LogsFolder))
-                Directory.Delete(LogsFolder, recursive: true);
+            if (Directory.Exists(LogsDirectory))
+                Directory.Delete(LogsDirectory, recursive: true);
         }

         [Test]


Make sure to unsubscribe >_<

Make sure to unsubscribe >_<

--- Connection.cs
+++ Connection.cs
@@ -321,6 +321,9 @@
         }

         public static void LeaveCloud(string id) {
+            Faye.Unsubscribe("/clouds/" + id + "/chat/messages");
+            Faye.Unsubscribe("/clouds/" + id + "/users/**");
+
             var jObj = new JObject();
             var dataString = jObj.ToString();
             var data = Encoding.UTF8.GetBytes(dataString);


* CoreConfig.cs: Deleted unused namespace

--- CoreConfig.cs
+++ CoreConfig.cs
@@ -42,7 +42,6 @@
 using System.Collections.Generic;
 using System.Linq;
 using System.Text;
-using System.IO.Compression;

 namespace Gitty.Core
 {


Correct handling of multiple protos (#97)

--- Google.Api.Generator/CodeGenerator.cs
+++ Google.Api.Generator/CodeGenerator.cs
@@ -44,26 +44,38 @@

         public static IEnumerable<ResultFile> Generate(IReadOnlyList<FileDescriptor> descriptors, IEnumerable<string> filesToGenerate, IClock clock)
         {
-            // TODO: Support multiple packages.
-            var packages = descriptors.Where(x => filesToGenerate.Contains(x.Name)).Select(x => x.Package).Distinct().ToList();
-            if (packages.Count == 0)
+            // TODO: Multi-package support not tested.
+            var filesToGenerateSet = filesToGenerate.ToHashSet();
+            var byPackage = descriptors.Where(x => filesToGenerateSet.Contains(x.Name)).GroupBy(x => x.Package).ToList();
+            if (byPackage.Count == 0)
             {
                 throw new InvalidOperationException("No packages specified to build.");
             }
-            if (packages.Count > 1)
+            foreach (var singlePackageFileDescs in byPackage)
             {
-                throw new InvalidOperationException($"More than one package specified to build: {string.Join(", ", packages)}");
+                var namespaces = singlePackageFileDescs.Select(x => x.CSharpNamespace()).Distinct().ToList();
+                if (namespaces.Count > 1)
+                {
+                    throw new InvalidOperationException(
+                        "All files in the same package must have the same C# namespace. " +
+                        $"Found namespaces '{string.Join(", ", namespaces)}' in package '{singlePackageFileDescs.Key}'.");
+                }
+                var catalog = new ProtoCatalog(singlePackageFileDescs.Key, descriptors);
+                foreach (var resultFile in GeneratePackage(namespaces[0], singlePackageFileDescs, catalog, clock))
+                {
+                    yield return resultFile;
+                }
             }
-            var package = packages[0];
-            var catalog = new ProtoCatalog(package, descriptors);
-            var packageFileDescs = descriptors.Where(x => x.Package == package).ToList();
-            foreach (var fileDesc in packageFileDescs)
+        }
+
+        private static IEnumerable<ResultFile> GeneratePackage(string ns, IEnumerable<FileDescriptor> packageFileDescriptors, ProtoCatalog catalog, IClock clock)
+        {
+            var clientPathPrefix = $"{ns}{Path.DirectorySeparatorChar}";
+            var snippetsPathPrefix = $"{ns}.Snippets{Path.DirectorySeparatorChar}";
+            var unitTestsPathPrefix = $"{ns}.Tests{Path.DirectorySeparatorChar}";
+            bool hasLro = false;
+            foreach (var fileDesc in packageFileDescriptors)
             {
-                var ns = fileDesc.CSharpNamespace();
-                var clientPathPrefix = $"{ns}{Path.DirectorySeparatorChar}";
-                var snippetsPathPrefix = $"{ns}.Snippets{Path.DirectorySeparatorChar}";
-                var unitTestsPathPrefix = $"{ns}.Tests{Path.DirectorySeparatorChar}";
-                bool hasLro = false;
                 foreach (var service in fileDesc.Services)
                 {
                     // Generate settings and client code for requested package.
@@ -101,19 +113,19 @@
                     var resContent = Encoding.UTF8.GetBytes(formattedResCode.ToFullString());
                     yield return new ResultFile(resFilename, resContent);
                 }
-                // Generate client csproj.
-                var csprojContent = Encoding.UTF8.GetBytes(CsProjGenerator.GenerateClient(hasLro));
-                var csprojFilename = $"{clientPathPrefix}{ns}.csproj";
-                yield return new ResultFile(csprojFilename, csprojContent);
-                // Generate snippets csproj.
-                var snippetsCsprojContent = Encoding.UTF8.GetBytes(CsProjGenerator.GenerateSnippets(ns));
-                var snippetsCsProjFilename = $"{snippetsPathPrefix}{ns}.Snippets.csproj";
-                yield return new ResultFile(snippetsCsProjFilename, snippetsCsprojContent);
-                // Generate unit-tests csproj.
-                var unitTestsCsprojContent = Encoding.UTF8.GetBytes(CsProjGenerator.GenerateUnitTests(ns));
-                var unitTestsCsprojFilename = $"{unitTestsPathPrefix}{ns}.Tests.csproj";
-                yield return new ResultFile(unitTestsCsprojFilename, unitTestsCsprojContent);
             }
+            // Generate client csproj.
+            var csprojContent = Encoding.UTF8.GetBytes(CsProjGenerator.GenerateClient(hasLro));
+            var csprojFilename = $"{clientPathPrefix}{ns}.csproj";
+            yield return new ResultFile(csprojFilename, csprojContent);
+            // Generate snippets csproj.
+            var snippetsCsprojContent = Encoding.UTF8.GetBytes(CsProjGenerator.GenerateSnippets(ns));
+            var snippetsCsProjFilename = $"{snippetsPathPrefix}{ns}.Snippets.csproj";
+            yield return new ResultFile(snippetsCsProjFilename, snippetsCsprojContent);
+            // Generate unit-tests csproj.
+            var unitTestsCsprojContent = Encoding.UTF8.GetBytes(CsProjGenerator.GenerateUnitTests(ns));
+            var unitTestsCsprojFilename = $"{unitTestsPathPrefix}{ns}.Tests.csproj";
+            yield return new ResultFile(unitTestsCsprojFilename, unitTestsCsprojContent);
         }

         private static IReadOnlyList<FileDescriptor> GetFileDescriptors(byte[] bytes)


Update GraphArea.cs (#95)

Update GraphArea.cs (#95)

* Update GraphArea.cs

Have noticed that sometimes during DeSerialization a failure for Source or Target to be updated properly will result in an uncaught exception to the Application Dispatcher.  It is best to test for a valid Source and Target Property value before attempting to retrieve a mapped value.

* Update GraphArea.cs

Testing revealed an issue.

--- GraphX.Controls/Controls/GraphArea.cs
+++ GraphX.Controls/Controls/GraphArea.cs
@@ -1738,9 +1738,17 @@
             }
             var ec = ctrl as EdgeControl;
             if (ec == null) return list;
+
             var edge = (TEdge)ec.Edge;
-            if (_vertexlist.ContainsKey(edge.Target)) list.Add(_vertexlist[edge.Target]);
-            if (_vertexlist.ContainsKey(edge.Source)) list.Add(_vertexlist[edge.Source]);
+            if (edge.Target != null && _vertexlist.ContainsKey(edge.Target))
+            {
+                list.Add(_vertexlist[edge.Target]);
+            }
+            if (edge.Source != null && _vertexlist.ContainsKey(edge.Source))
+            {
+                list.Add(_vertexlist[edge.Source]);
+            }
+
             return list;
         }


host and config updates when toggle switching

--- anchor/MainWindow.xaml.cs
+++ anchor/MainWindow.xaml.cs
@@ -32,6 +32,8 @@
         HostEditor hostEditor = new HostEditor(System.IO.Path.Combine(Environment.GetEnvironmentVariable("SystemRoot"), "System32\\drivers\\etc\\hosts"));

         Driver driver;
+
+        ConfigWriter writer;

         public MainWindow()
         {
@@ -59,6 +61,7 @@
             loadEntries();
             loadSettings();
             driver = new WampServer(settings.WampServerPath);
+            writer = new ConfigWriter(System.IO.Path.Combine(driver.ApacheConfigPath, "anchor.conf"));
         }

         private void restartApache()
@@ -144,7 +147,6 @@
                 entries.Add(new Entry { Name = hostName, Path = path });
                 hostEditor.add(hostName + ".dev");
                 hostEditor.update();
-                ConfigWriter writer = new ConfigWriter(System.IO.Path.Combine(driver.ApacheConfigPath, "anchor.conf"));
                 writer.write(driver.ServerRootPath, entries.ToList());
                 this.restartApache();
                 lstSites.DataContext = entries;
@@ -187,13 +189,11 @@
                     hostEditor.remove(entry.Name + ".dev");
                     hostEditor.update();
                     entries.Remove(entry);
-                    ConfigWriter writer = new ConfigWriter(System.IO.Path.Combine(driver.ApacheConfigPath, "anchor.conf"));
                     writer.write(driver.ServerRootPath, entries.ToList());
                     this.restartApache();
                     lstSites.DataContext = entries;
                     if (entries.Count == 0)
                     {
-
                         lblNoSites.Visibility = System.Windows.Visibility.Visible;
                         lstSites.Visibility = System.Windows.Visibility.Collapsed;
                     }
@@ -280,10 +280,21 @@
             if (tgbEnableDisable.IsChecked)
             {
                 lblToggleState.Text = "ON";
+                foreach (Entry entry in entries)
+                {
+                    hostEditor.add(entry.Name + ".dev");
+                }
+                hostEditor.update();
+                writer.write(driver.ServerRootPath, entries.ToList());
+                this.restartApache();
             }
             else
             {
                 lblToggleState.Text = "OFF";
+                hostEditor.clear();
+                hostEditor.update();
+                writer.write(driver.ServerRootPath, new List<Entry>());
+                this.restartApache();
             }
         }
     }


fix parsing package version with "preview"

--- resharper/resharper-unity/src/Rider/UnityPluginInstaller.cs
+++ resharper/resharper-unity/src/Rider/UnityPluginInstaller.cs
@@ -120,7 +120,9 @@
                 var match = Regex.Match(text, @"""com\.unity\.ide\.rider""\s*:\s*""(?<version>.*)""", RegexOptions.Multiline);
                 if (match.Success)
                 {
-                    if (Version.TryParse(match.Groups["version"].Value, out var version))
+                    //it could be "com.unity.ide.rider": "1.1.2-preview"
+                    var versionString = match.Groups["version"].Value.Replace("-preview", string.Empty);
+                    if (Version.TryParse(versionString, out var version))
                     {
                         if (version >= new Version(1, 0, 7))
                         {


Changed ScopeAttribute semantics to OR

Changed ScopeAttribute semantics to OR

--- source/Thinktecture.IdentityModel.WebApi/ScopeAttribute.cs
+++ source/Thinktecture.IdentityModel.WebApi/ScopeAttribute.cs
@@ -39,13 +39,13 @@

             foreach (var scope in _scopes)
             {
-                if (!grantedScopes.Contains(scope))
+                if (grantedScopes.Contains(scope, StringComparer.OrdinalIgnoreCase))
                 {
-                    return false;
+                    return true;
                 }
             }

-            return true;
+            return false;
         }
     }
 }


Fixed a sample framework bug. Resolves issue 455.

--- samples/SampleFramework/DeviceSettings/ConversionMethods.cs
+++ samples/SampleFramework/DeviceSettings/ConversionMethods.cs
@@ -230,6 +230,19 @@
                     return SlimDX.DXGI.Format.R32G32_Float;
                 case Format.A32B32G32R32F:
                     return SlimDX.DXGI.Format.R32G32B32A32_Float;
+                case Format.D15S1:
+                case Format.D16:
+                case Format.D16Lockable:
+                    return SlimDX.DXGI.Format.D16_UNorm;
+                case Format.D24S8:
+                case Format.D24SingleS8:
+                case Format.D24X4S4:
+                case Format.D24X8:
+                    return SlimDX.DXGI.Format.D24_UNorm_S8_UInt;
+                case Format.D32:
+                case Format.D32Lockable:
+                case Format.D32SingleLockable:
+                    return SlimDX.DXGI.Format.D32_Float;
             }

             return SlimDX.DXGI.Format.Unknown;


Added Vector3/d.IsInf and .Invalid (= .IsNan || .IsInf) methods.

--- Extensions.cs
+++ Extensions.cs
@@ -73,6 +73,17 @@

 		public static bool IsNaN(this Vector3 v)
 		{ return float.IsNaN(v.x) || float.IsNaN(v.y) || float.IsNaN(v.z); }
+
+		public static bool IsInf(this Vector3d v)
+		{ return double.IsInfinity(v.x) || double.IsInfinity(v.y) || double.IsInfinity(v.z); }
+
+		public static bool IsInf(this Vector3 v)
+		{ return float.IsInfinity(v.x) || float.IsInfinity(v.y) || float.IsInfinity(v.z); }
+
+		public static bool Invalid(this Vector3d v) { return v.IsNaN() || v.IsInf(); }
+
+		public static bool Invalid(this Vector3 v) { return v.IsNaN() || v.IsInf(); }
+

 		public static Vector3 CubeNorm(this Vector3 v)
 		{


1465.1


Add time

Add time

--- IoTSensors/ReadService/StartupTask.cs
+++ IoTSensors/ReadService/StartupTask.cs
@@ -85,7 +85,7 @@
         const string HUMIDMEASURE = "Humidity";
         const string TEMPUNITS = "C";
         const string HUMIDUNITS = "%";
-        const string jsonFormat = "{{\"guid\":\"{0}\", \"organization\":\"{1}\", \"displayname\": \"{2}\", \"location\": \"{3}\", \"measurename\": \"{4}\", \"unitofmeasure\": \"{5}\", \"value\":{6} }}";
+        const string jsonFormat = "{{\"guid\":\"{0}\", \"organization\":\"{1}\", \"displayname\": \"{2}\", \"location\": \"{3}\", \"measurename\": \"{4}\", \"unitofmeasure\": \"{5}\", \"value\":{6}, \"timeCreated\":\"{7}\" }}";

         private async Task SendEvents(DeviceClient deviceClient)
@@ -103,11 +103,11 @@
                         try {
                             System.Diagnostics.Debug.WriteLine(string.Format("Temp:{0} Hum:{1}", data.Temperature, data.Humidity));
                             dataBuffer = string.Format(jsonFormat,
-                                GUID, ORGANIZATION, DISPLAYNAME, LOCATION, TEMPMEASURE, TEMPUNITS, data.Temperature);
+                                GUID, ORGANIZATION, DISPLAYNAME, LOCATION, TEMPMEASURE, TEMPUNITS, data.Temperature, DateTime.UtcNow);
 Message eventMessage = new Message(Encoding.UTF8.GetBytes(dataBuffer));
                             await deviceClient.SendEventAsync(eventMessage);
                             dataBuffer = string.Format(jsonFormat,
-                                GUID, ORGANIZATION, DISPLAYNAME, LOCATION, HUMIDMEASURE, HUMIDUNITS, data.Humidity);
+                                GUID, ORGANIZATION, DISPLAYNAME, LOCATION, HUMIDMEASURE, HUMIDUNITS, data.Humidity, DateTime.UtcNow);
                             eventMessage = new Message(Encoding.UTF8.GetBytes(dataBuffer));
                             await deviceClient.SendEventAsync(eventMessage);
                         }


Changed WasEdgeFound in dykstra to used a directed edge id.

--- Itinero/Algorithms/Default/Dykstra.cs
+++ Itinero/Algorithms/Default/Dykstra.cs
@@ -155,7 +155,7 @@
                     _current.From.Vertex == neighbour)
                 { // don't go back, but report on the visit if needed.
                     if(this.WasEdgeFound != null &&
-                       this.WasEdgeFound(_current.Vertex, edge.Id, _current.Weight))
+                       this.WasEdgeFound(_current.Vertex, edge.IdDirected(), _current.Weight))
                     { // edge was found and true was returned, this search should stop.
                         return false;
                     }
@@ -165,7 +165,7 @@
                 if (_visits.ContainsKey(neighbour))
                 { // has already been choosen.
                     if (this.WasEdgeFound != null &&
-                        this.WasEdgeFound(_current.Vertex, edge.Id, _current.Weight))
+                        this.WasEdgeFound(_current.Vertex, edge.IdDirected(), _current.Weight))
                     { // some edges are never in any shortest path between some two vertices.
                         return false;
                     }
@@ -247,7 +247,7 @@
         /// <summary>
         /// The was edge found delegate.
         /// </summary>
-        public delegate bool WasEdgeFoundDelegate(uint vertex, uint edge, float weight);
+        public delegate bool WasEdgeFoundDelegate(uint vertex, long directedEdgeId, float weight);

         /// <summary>
         /// Gets or sets the wasfound function to be called when a new vertex is found.


[vstool] get file items all at once.

[vstool] get file items all at once.

--- sdmap/src/sdmap.vstool/NavigateTo/NavigateToItemProvider.cs
+++ sdmap/src/sdmap.vstool/NavigateTo/NavigateToItemProvider.cs
@@ -28,13 +28,8 @@
             var solution = (IVsSolution)Package.GetGlobalService(typeof(IVsSolution));
             foreach (Project project in Util.GetCSharpProjects(solution))
             {
-                var items = project.ProjectItems
+                var files = project.ProjectItems
                     .OfType<ProjectItem>()
-                    .ToList();
-                var languages = items
-                    .Select(x => x.FileCodeModel?.Language)
-                    .ToList();
-                var files = items
                     .SelectMany(x =>
                     {
                         var filenames = new List<string>(x.FileCount);
@@ -44,8 +39,7 @@
                         }
                         return filenames;
                     })
-                    .ToList();
-                Debug.WriteLine(items);
+                    .Where(x => x.ToUpperInvariant().EndsWith(".sdmap"));
             }

             callback.AddItem(new NavigateToItem(


address Antoine's comments

address Antoine's comments

--- src/Algolia.Search/Models/Search/PartialUpdateOperation.cs
+++ src/Algolia.Search/Models/Search/PartialUpdateOperation.cs
@@ -46,8 +46,6 @@
         /// <summary>
         /// Increment by an integer value
         /// </summary>
-        /// <param name="value"></param>
-        /// <returns></returns>
         public static PartialUpdateOperation<int> Increment(int value)
         {
             return new PartialUpdateOperation<int>
@@ -60,8 +58,6 @@
         /// <summary>
         /// Increment a numeric integer attribute only if the provided value matches the current value, and otherwise ignores the whole object update
         /// </summary>
-        /// <param name="value"></param>
-        /// <returns></returns>
         public static PartialUpdateOperation<int> IncrementFrom(int value)
         {
             return new PartialUpdateOperation<int>
@@ -88,8 +84,6 @@
         /// <summary>
         /// Decrement by an integer value
         /// </summary>
-        /// <param name="value"></param>
-        /// <returns></returns>
         public static PartialUpdateOperation<int> Decrement(int value)
         {
             return new PartialUpdateOperation<int>
@@ -116,8 +110,6 @@
         /// <summary>
         /// Add value to a collection if it does not exist
         /// </summary>
-        /// <param name="value"></param>
-        /// <returns></returns>
         public static PartialUpdateOperation<T> AddUnique(T value)
         {
             return new PartialUpdateOperation<T>
@@ -130,8 +122,6 @@
         /// <summary>
         /// Remove value from a collection
         /// </summary>
-        /// <param name="value"></param>
-        /// <returns></returns>
         public static PartialUpdateOperation<T> Remove(T value)
         {
             return new PartialUpdateOperation<T>


Inclusive ConfidenceInterval.Contains

Inclusive ConfidenceInterval.Contains

--- src/BenchmarkDotNet.Core/Mathematics/ConfidenceInterval.cs
+++ src/BenchmarkDotNet.Core/Mathematics/ConfidenceInterval.cs
@@ -125,7 +125,7 @@
             Upper = mean + Margin;
         }

-        public bool Contains(double value) => Lower < value && value < Upper;
+        public bool Contains(double value) => Lower - 1e-9 < value && value < Upper + 1e-9;

         public string ToStr(bool showLevel = true) => $"[{Lower.ToStr()}; {Upper.ToStr()}] (CI {Level.ToPercentStr()})";


Delete unnecessary method (dotnet/coreclr#25661)

Signed-off-by: dotnet-bot <03c4cb6107ae99956a7681f2c97ff7104809a2bd@microsoft.com>

--- src/Common/src/CoreLib/System/Globalization/CultureData.cs
+++ src/Common/src/CoreLib/System/Globalization/CultureData.cs
@@ -1576,22 +1576,11 @@
                         shortTimes = DeriveShortTimesFromLong();
                     }

-                    /* The above logic doesn't make sense on Mac, since the OS can provide us a "short time pattern".
-                     * currently this is the 4th element in the array returned by LongTimes.  We'll add this to our array
-                     * if it doesn't exist.
-                     */
-                    shortTimes = AdjustShortTimesForMac(shortTimes);
-
                     // Found short times, use them
                     _saShortTimes = shortTimes;
                 }
                 return _saShortTimes;
             }
-        }
-
-        private string[] AdjustShortTimesForMac(string[] shortTimes)
-        {
-            return shortTimes;
         }

         private string[] DeriveShortTimesFromLong()


[DEV] Make PrintHelp virtual

[DEV] Make PrintHelp virtual

--- AntShell/Commands/CommandBase.cs
+++ AntShell/Commands/CommandBase.cs
@@ -37,7 +37,7 @@

         #region ICommandDescription implementation

-        public void PrintHelp(ICommandInteraction writer)
+        public virtual void PrintHelp(ICommandInteraction writer)
         {
             writer.WriteLine(this.GetHelp());
         }


Add some more documentation for ValueTask (#29726)

* Add some more documentation for ValueTask

* Address PR feedback

--- src/Common/src/CoreLib/System/Threading/Tasks/ValueTask.cs
+++ src/Common/src/CoreLib/System/Threading/Tasks/ValueTask.cs
@@ -32,10 +32,28 @@

     /// Provides an awaitable result of an asynchronous operation.
     /// <remarks>
-    /// <see cref="ValueTask"/>s are meant to be directly awaited.  To do more complicated operations with them, a <see cref="Task"/>
-    /// should be extracted using <see cref="AsTask"/>.  Such operations might include caching an instance to be awaited later,
-    /// registering multiple continuations with a single operation, awaiting the same task multiple times, and using combinators over
-    /// multiple operations.
+    /// <see cref="ValueTask"/> instances are meant to be directly awaited.  To do more complicated operations with them, a <see cref="Task"/>
+    /// should be extracted using <see cref="AsTask"/>.  Such operations might include caching a task instance to be awaited later,
+    /// registering multiple continuations with a single task, awaiting the same task multiple times, and using combinators over
+    /// multiple operations:
+    /// <list type="bullet">
+    /// <item>
+    /// Once the result of a <see cref="ValueTask"/> instance has been retrieved, do not attempt to retrieve it again.
+    /// <see cref="ValueTask"/> instances may be backed by <see cref="IValueTaskSource"/> instances that are reusable, and such
+    /// instances may use the act of retrieving the instances result as a notification that the instance may now be reused for
+    /// a different operation.  Attempting to then reuse that same <see cref="ValueTask"/> results in undefined behavior.
+    /// </item>
+    /// <item>
+    /// Do not attempt to add multiple continuations to the same <see cref="ValueTask"/>.  While this might work if the
+    /// <see cref="ValueTask"/> wraps a T or a <see cref="Task"/>, it may not work if the <see cref="ValueTask"/>
+    /// was constructed from an <see cref="IValueTaskSource"/>.
+    /// </item>
+    /// <item>
+    /// Some operations that return a <see cref="ValueTask"/> may invalidate it based on some subsequent operation being performed.
+    /// Unless otherwise documented, assume that a <see cref="ValueTask"/> should be awaited prior to performing any additional operations
+    /// on the instance from which it was retrieved.
+    /// </item>
+    /// </list>
     /// </remarks>
     [AsyncMethodBuilder(typeof(AsyncValueTaskMethodBuilder))]
     [StructLayout(LayoutKind.Auto)]
@@ -408,10 +426,28 @@
     /// Provides a value type that can represent a synchronously available value or a task object.
     /// <typeparam name="TResult">Specifies the type of the result.</typeparam>
     /// <remarks>
-    /// <see cref="ValueTask{TResult}"/>s are meant to be directly awaited.  To do more complicated operations with them, a <see cref="Task"/>
-    /// should be extracted using <see cref="AsTask"/> or <see cref="Preserve"/>.  Such operations might include caching an instance to
-    /// be awaited later, registering multiple continuations with a single operation, awaiting the same task multiple times, and using
-    /// combinators over multiple operations.
+    /// <see cref="ValueTask{TResult}"/> instances are meant to be directly awaited.  To do more complicated operations with them, a <see cref="Task{TResult}"/>
+    /// should be extracted using <see cref="AsTask"/>.  Such operations might include caching a task instance to be awaited later,
+    /// registering multiple continuations with a single task, awaiting the same task multiple times, and using combinators over
+    /// multiple operations:
+    /// <list type="bullet">
+    /// <item>
+    /// Once the result of a <see cref="ValueTask{TResult}"/> instance has been retrieved, do not attempt to retrieve it again.
+    /// <see cref="ValueTask{TResult}"/> instances may be backed by <see cref="IValueTaskSource{TResult}"/> instances that are reusable, and such
+    /// instances may use the act of retrieving the instances result as a notification that the instance may now be reused for
+    /// a different operation.  Attempting to then reuse that same <see cref="ValueTask{TResult}"/> results in undefined behavior.
+    /// </item>
+    /// <item>
+    /// Do not attempt to add multiple continuations to the same <see cref="ValueTask{TResult}"/>.  While this might work if the
+    /// <see cref="ValueTask{TResult}"/> wraps a T or a <see cref="Task{TResult}"/>, it may not work if the <see cref="Task{TResult}"/>
+    /// was constructed from an <see cref="IValueTaskSource{TResult}"/>.
+    /// </item>
+    /// <item>
+    /// Some operations that return a <see cref="ValueTask{TResult}"/> may invalidate it based on some subsequent operation being performed.
+    /// Unless otherwise documented, assume that a <see cref="ValueTask{TResult}"/> should be awaited prior to performing any additional operations
+    /// on the instance from which it was retrieved.
+    /// </item>
+    /// </list>
     /// </remarks>
     [AsyncMethodBuilder(typeof(AsyncValueTaskMethodBuilder<>))]
     [StructLayout(LayoutKind.Auto)]


ConcurrentSortedList

ConcurrentSortedList

--- src/Commons.Collections/Concurrent/ConcurrentSortedList.cs
+++ src/Commons.Collections/Concurrent/ConcurrentSortedList.cs
@@ -31,12 +31,14 @@
     {
         private Node<T> head;
         private Node<T> tail;
+        private IComparer<T> comparer;

         public ConcurrentSortedList()
         {
             head = new Node<T>();
             tail = new Node<T>();
             head.Next = tail;
+            comparer = Comparer<T>.Default;
         }

         private bool Insert(T item)
@@ -51,18 +53,37 @@
             return false;
         }

-        private Node<T> Search(T item, out Node<T> leftNode)
+        private Node<T> Search(T key, out Node<T> leftNode)
         {
-            Node<T> leftNodeNext, rightNode;
+            Node<T> leftNodeNext = null;
+            Node<T> rightNode = null;
             while (true)
             {
                 do
                 {
-                    var temp = head;
-                    var tempNext = head.Next;
+                    var cursor = head;
+                    var nextCursor = head.Next;
                     do
                     {
-                    } while (true);
+                        if (nextCursor.Marked == 0)
+                        {
+                            leftNode = cursor;
+                            leftNodeNext = nextCursor;
+                        }
+                        cursor = Unmark(nextCursor);
+                        if (cursor == tail)
+                        {
+                            break;
+                        }
+                        nextCursor = cursor.Next;
+                    } while (nextCursor.Marked == 1 || comparer.Compare(cursor.Key, key) < 0);
+                    rightNode = cursor;
+                    if (leftNodeNext == rightNode)
+                    {
+                        if (rightNode != tail && rightNode.Next.Marked == 1)
+                        {
+                        }
+                    }
                 } while (true);
             }

@@ -76,10 +97,6 @@

         private Node<T> Unmark(Node<T> node)
         {
-            var atomic = Atomic<Node<T>>.From(node);
-            while (!atomic.CompareExchange(new Node<T> { Key = node.Key, Marked = 0, Next = node.Next }))
-            {
-            }

             return null;
         }


Fix status text.

Fix status text.

--- src/CompetitionPlatform/Views/Project/CreateProject.cshtml
+++ src/CompetitionPlatform/Views/Project/CreateProject.cshtml
@@ -48,7 +48,7 @@

-                                    Lykke members have to summit the project application form to take part in your project. Registration deadline is time when you announce your project and early birds can register. Other participants may register any time from the project start till is implementation deadline.
+                                    Lykke members have to submit the project application form to take part in your project. Registration deadline is a date when you announce your project and early birds can register. Other participants may register at any time from the project start till is implementation deadline.


Ignores requests to create ads when not using smartads.

--- Assets/DeltaDNA/EngageFactory.cs
+++ Assets/DeltaDNA/EngageFactory.cs
@@ -113,23 +113,27 @@
         /// <param name="callback">the callback to handle the result</param>
         public void RequestInterstitialAd(string decisionPoint, Params parameters, Action<InterstitialAd> callback) {

-            Engagement engagement = BuildEngagement(decisionPoint, parameters)
-                .AddParam("ddnaAdSessionCount", smartads.GetSessionCount(decisionPoint))
-                .AddParam("ddnaAdDailyCount", smartads.GetDailyCount(decisionPoint));
+            if (smartads != null)
+            {
+                Engagement engagement = BuildEngagement(decisionPoint, parameters)
+                    .AddParam("ddnaAdSessionCount", smartads.GetSessionCount(decisionPoint))
+                    .AddParam("ddnaAdDailyCount", smartads.GetDailyCount(decisionPoint));

-            if (smartads.GetLastShown(decisionPoint).HasValue) {
-                engagement.AddParam("ddnaAdLastShownTime", smartads.GetLastShown(decisionPoint).Value);
+                if (smartads.GetLastShown(decisionPoint).HasValue)
+                {
+                    engagement.AddParam("ddnaAdLastShownTime", smartads.GetLastShown(decisionPoint).Value);
+                }
+
+                ddna.RequestEngagement(engagement,
+                    (response) =>
+                    {
+                        callback(InterstitialAd.CreateUnchecked(response));
+                    }, (exception) =>
+                    {
+                        Logger.LogWarning("Creating interstitial ad despite failed Engage request");
+                        callback(InterstitialAd.CreateUnchecked(engagement));
+                    });
             }
-
-            ddna.RequestEngagement(engagement,
-                (response) =>
-                {
-                    callback(InterstitialAd.CreateUnchecked(response));
-                }, (exception) =>
-                {
-                    Logger.LogWarning("Creating interstitial ad despite failed Engage request");
-                    callback(InterstitialAd.CreateUnchecked(engagement));
-                });
         }

         /// <summary>
@@ -148,24 +152,28 @@
         /// <param name="parameters">an optional set of real-time parameters</param>
         /// <param name="callback">the callback to handle the result</param>
         public void RequestRewardedAd(string decisionPoint, Params parameters, Action<RewardedAd> callback) {
-
-            Engagement engagement = BuildEngagement(decisionPoint, parameters)
-                .AddParam("ddnaAdSessionCount", smartads.GetSessionCount(decisionPoint))
-                .AddParam("ddnaAdDailyCount", smartads.GetDailyCount(decisionPoint));

-            if (smartads.GetLastShown(decisionPoint).HasValue) {
-                engagement.AddParam("ddnaAdLastShownTime", smartads.GetLastShown(decisionPoint).Value);
+            if (smartads != null)
+            {
+                Engagement engagement = BuildEngagement(decisionPoint, parameters)
+                    .AddParam("ddnaAdSessionCount", smartads.GetSessionCount(decisionPoint))
+                    .AddParam("ddnaAdDailyCount", smartads.GetDailyCount(decisionPoint));
+
+                if (smartads.GetLastShown(decisionPoint).HasValue)
+                {
+                    engagement.AddParam("ddnaAdLastShownTime", smartads.GetLastShown(decisionPoint).Value);
+                }
+
+                ddna.RequestEngagement(engagement,
+                    (response) =>
+                    {
+                        callback(RewardedAd.CreateUnchecked(response));
+                    }, (exception) =>
+                    {
+                        Logger.LogWarning("Creating rewarded ad despite failed Engage request");
+                        callback(RewardedAd.CreateUnchecked(engagement));
+                    });
             }
-
-            ddna.RequestEngagement(engagement,
-                (response) =>
-                {
-                    callback(RewardedAd.CreateUnchecked(response));
-                }, (exception) =>
-                {
-                    Logger.LogWarning("Creating rewarded ad despite failed Engage request");
-                    callback(RewardedAd.CreateUnchecked(engagement));
-                });
         }

         protected static Engagement BuildEngagement(string decisionPoint, Params parameters) {


Hot-Fixed SimplePropertyReaderWriter (problem for creating reader or writer)

--- src/EfCore.Shaman/Reflection/SimplePropertyReaderWriter.cs
+++ src/EfCore.Shaman/Reflection/SimplePropertyReaderWriter.cs
@@ -12,38 +12,46 @@
     {
         #region Constructors

-        /// <summary>
-        /// Inspired by http://stackoverflow.com/questions/1272454/generate-dynamic-method-to-set-a-field-of-a-struct-instead-of-using-reflection
-        /// </summary>
-        /// <param name="instance"></param>
-        /// <param name="value"></param>
-        delegate void ByRefStructAction(ref object instance, object value);
         public SimplePropertyReaderWriter(Type type, PropertyInfo propertyInfo)
         {
             _propertyInfo = propertyInfo;
+            try
             {
-                var instance = Expression.Parameter(typeof(object), "instance");
-                Expression expr = Expression.Property(Expression.Convert(instance, type), propertyInfo.Name);
-                Expression convertedToObject = Expression.Convert(expr, typeof(object));
-                _reader = Expression.Lambda<Func<object, object>>(convertedToObject, instance).Compile();
+                {
+                    var instance = Expression.Parameter(typeof(object), "instance");
+                    Expression expr = Expression.Property(Expression.Convert(instance, type), propertyInfo.Name);
+                    Expression convertedToObject = Expression.Convert(expr, typeof(object));
+                    _reader = Expression.Lambda<Func<object, object>>(convertedToObject, instance).Compile();
+                }
             }
+            catch (Exception e)
             {
-                var instance = Expression.Parameter(typeof(object).MakeByRefType(), "instance");
-                var value = Expression.Parameter(typeof(object), "value");
+                // use reflection
+            }
+            try
+            {
+                {
+                    var instance = Expression.Parameter(typeof(object).MakeByRefType(), "instance");
+                    var value = Expression.Parameter(typeof(object), "value");

-                Expression<ByRefStructAction> expr =
-                    Expression.Lambda<ByRefStructAction>(
-                        Expression.Assign(
-                            Expression.Property(
-                                Expression.Convert(instance, type),
-                                propertyInfo),
-                            Expression.Convert(
-                                value,
-                                propertyInfo.PropertyType)),
-                        instance,
-                        value);
+                    var expr =
+                        Expression.Lambda<ByRefStructAction>(
+                            Expression.Assign(
+                                Expression.Property(
+                                    Expression.Convert(instance, type),
+                                    propertyInfo),
+                                Expression.Convert(
+                                    value,
+                                    propertyInfo.PropertyType)),
+                            instance,
+                            value);

-                _writer = expr.Compile();
+                    _writer = expr.Compile();
+                }
+            }
+            catch (Exception e)
+            {
+                // use reflection
             }
         }

@@ -53,13 +61,16 @@

         public object ReadPropertyValue(object obj)
         {
-            return _reader(obj);
+            if (_reader != null)
+                return _reader(obj);
+            return _propertyInfo.GetValue(obj);
         }

         public void WritePropertyValue(object obj, object value)
         {
-            _writer.Invoke(ref obj, value);
-            // _propertyInfo.SetValue(obj, value);
+            if (_writer != null)
+                _writer.Invoke(ref obj, value);
+            _propertyInfo.SetValue(obj, value);
         }

         #endregion
@@ -71,5 +82,17 @@
         private readonly ByRefStructAction _writer;

         #endregion
+
+        #region Delegates
+
+        /// <summary>
+        ///     Inspired by
+        ///     http://stackoverflow.com/questions/1272454/generate-dynamic-method-to-set-a-field-of-a-struct-instead-of-using-reflection
+        /// </summary>
+        /// <param name="instance"></param>
+        /// <param name="value"></param>
+        private delegate void ByRefStructAction(ref object instance, object value);
+
+        #endregion
     }
 }


stylecop

stylecop

--- source/DotNetBay.Data.FileStorage/InMemoryMainRepository.cs
+++ source/DotNetBay.Data.FileStorage/InMemoryMainRepository.cs
@@ -162,7 +162,6 @@
                 var auction = this.data.Auctions.FirstOrDefault(a => a.Id == bid.Auction.Id);
                 auction.Bids.Add(bid);

-
                 // Reference back from bidder
                 var bidder = this.data.Members.FirstOrDefault(b => b.UniqueId == bid.Bidder.UniqueId);
                 if (bidder.Bids == null)


Refactoring portable settings provider, fixed potential crash when saving settings

--- source/PortableSettingsProvider/PortableSettingsProvider.cs
+++ source/PortableSettingsProvider/PortableSettingsProvider.cs
@@ -35,8 +35,10 @@
             //Do nothing
             set { }
         }
-
+
         private XmlDocument _settingsXml;
+        private XmlNode _settingsRootNode;
+
         private XmlDocument SettingsXml
         {
             get
@@ -66,6 +68,16 @@
             }
         }

+        private XmlNode SettingsRootNode
+        {
+            get
+            {
+                if (_settingsRootNode == null)
+                    _settingsRootNode = SettingsXml.SelectSingleNode(SettingsRootName);
+                return _settingsRootNode;
+            }
+        }
+
         public override void Initialize(string name, NameValueCollection col)
         {
             base.Initialize(ApplicationName, col);
@@ -161,12 +173,13 @@
             {
                 if (IsRoaming(propVal.Property))
                 {
-                    settingNode = (XmlElement) SettingsXml.SelectSingleNode(SettingsRootName + "/" + propVal.Name);
+                    settingNode = (XmlElement)SettingsXml.SelectSingleNode(
+                        SettingsRootName + "/" + propVal.Name);
                 }
                 else
                 {
-                    settingNode = (XmlElement) SettingsXml.SelectSingleNode(SettingsRootName + "/" + Environment.MachineName
-                                                                            + "/" + propVal.Name);
+                    settingNode = (XmlElement)SettingsXml.SelectSingleNode(
+                        SettingsRootName + "/" + Environment.MachineName + "/" + propVal.Name);
                 }
             }
             catch (Exception)
@@ -174,7 +187,6 @@
                 settingNode = null;
             }

-            //Check to see if the node exists, if so then set its new value
             if (settingNode != null)
             {
                 settingNode.InnerText = propVal.SerializedValue.ToString();
@@ -183,55 +195,69 @@
             {
                 if (IsRoaming(propVal.Property))
                 {
-                    //Store the value as an element of the Settings Root Node
-                    settingNode = SettingsXml.CreateElement(propVal.Name);
-                    settingNode.InnerText = propVal.SerializedValue.ToString();
-                    SettingsXml.SelectSingleNode(SettingsRootName).AppendChild(settingNode);
+                    CreateRoamingValue(propVal);
                 }
                 else
                 {
-                    //Its machine specific, store as an element of the machine name node,
-                    //creating a new machine name node if one doesnt exist.
-                    XmlElement machineNode;
-                    try
-                    {
-                        machineNode =
-                            (XmlElement) SettingsXml.SelectSingleNode(SettingsRootName + "/" + Environment.MachineName);
-                    }
-                    catch (Exception)
-                    {
-                        machineNode = SettingsXml.CreateElement(Environment.MachineName);
-                        SettingsXml.SelectSingleNode(SettingsRootName).AppendChild(machineNode);
-                    }
-
-                    if (machineNode == null)
-                    {
-                        machineNode = SettingsXml.CreateElement(Environment.MachineName);
-                        SettingsXml.SelectSingleNode(SettingsRootName).AppendChild(machineNode);
-                    }
-
-                    settingNode = SettingsXml.CreateElement(propVal.Name);
-                    settingNode.InnerText = propVal.SerializedValue.ToString();
-                    machineNode.AppendChild(settingNode);
-                }
-            }
-        }
-
+                    CreateLocalValue(propVal);
+                }
+            }
+        }
+
+        /// <summary>
+        /// Its machine specific, store as an element of the machine name node,
+        /// creating a new machine name node if one doesnt exist.
+        /// </summary>
+        private void CreateLocalValue(SettingsPropertyValue propVal)
+        {
+            XmlElement machineNode;
+            try
+            {
+                machineNode = (XmlElement)SettingsXml.SelectSingleNode(
+                    SettingsRootName + "/" + Environment.MachineName);
+            }
+            catch (Exception)
+            {
+                machineNode = SettingsXml.CreateElement(Environment.MachineName);
+                SettingsRootNode.AppendChild(machineNode);
+            }
+
+            if (machineNode == null)
+            {
+                machineNode = SettingsXml.CreateElement(Environment.MachineName);
+                SettingsRootNode.AppendChild(machineNode);
+            }
+
+            var settingNode = SettingsXml.CreateElement(propVal.Name);
+            settingNode.InnerText = propVal.SerializedValue.ToString();
+            machineNode.AppendChild(settingNode);
+        }
+
+        /// <summary>
+        /// Store the value as an element of the Settings Root Node
+        /// </summary>
+        private void CreateRoamingValue(SettingsPropertyValue propVal)
+        {
+            var settingNode = SettingsXml.CreateElement(propVal.Name);
+            settingNode.InnerText = propVal.SerializedValue.ToString();
+            SettingsRootNode.AppendChild(settingNode);
+        }
+
+        /// <summary>
+        /// Determine if the setting is marked as Roaming
+        /// </summary>
         private bool IsRoaming(SettingsProperty prop)
         {
-            //Determine if the setting is marked as Roaming
-            return prop.Attributes.Cast<DictionaryEntry>().Select(x => x.Value)
-                .OfType<SettingsManageabilityAttribute>().Any();
-
-            /*foreach (DictionaryEntry d in prop.Attributes)
-            {
-                Attribute a = (Attribute)d.Value;
-                if (a is SettingsManageabilityAttribute)
-                {
-                    return true;
-                }
-            }
-            return false;*/
+            try
+            {
+                return prop.Attributes.Cast<DictionaryEntry>().Select(x => x.Value)
+                    .OfType<SettingsManageabilityAttribute>()
+                    .Any(x => x.Manageability == SettingsManageability.Roaming);
+            }
+            catch (Exception)
+            {
+                return false;
+            }
         }
     }
 }


ASP.NET: Set profiler timing root name always

--- src/MiniProfiler/ProfileProviders/AspNetRequestProvider.cs
+++ src/MiniProfiler/ProfileProviders/AspNetRequestProvider.cs
@@ -164,18 +164,19 @@
         /// <param name="context">The <see cref="HttpContext"/> request to get the name from.</param>
         private static void EnsureName(MiniProfiler profiler, HttpContext context)
         {
+            string url = null;
+            string GetUrl() => url ?? (url = StringBuilderCache.Get()
+                                    .Append(context.Request.Url.Scheme)
+                                    .Append("://")
+                                    .Append(context.Request.Url.Host)
+                                    .Append(context.Request.Url.PathAndQuery)
+                                    .ToStringRecycle());
+
             // also set the profiler name to Controller/Action or /url
             if (profiler.Name.IsNullOrWhiteSpace())
             {
                 var rc = context.Request.RequestContext;
                 RouteValueDictionary values;
-
-                var url = StringBuilderCache.Get()
-                        .Append(context.Request.Url.Scheme)
-                        .Append("://")
-                        .Append(context.Request.Url.Host)
-                        .Append(context.Request.Url.PathAndQuery)
-                        .ToStringRecycle();

                 if (rc?.RouteData != null && (values = rc.RouteData.Values).Count > 0)
                 {
@@ -190,15 +191,15 @@

                 if (profiler.Name.IsNullOrWhiteSpace())
                 {
-                    profiler.Name = url ?? string.Empty;
+                    profiler.Name = GetUrl() ?? string.Empty;
                     if (profiler.Name.Length > 50)
                         profiler.Name = profiler.Name.Remove(50);
                 }
-
-                if (profiler.Name.HasValue() && profiler.Root != null && profiler.Root.Name == null)
-                {
-                    profiler.Root.Name = url;
-                }
+            }
+
+            if (profiler.Root != null && profiler.Root.Name == null)
+            {
+                profiler.Root.Name = GetUrl();
             }
         }
     }


Made MassTransit use JSON for serialization.

--- src/Common/Hadouken.Common.Messaging.Msmq/MsmqMessageBus.cs
+++ src/Common/Hadouken.Common.Messaging.Msmq/MsmqMessageBus.cs
@@ -34,6 +34,9 @@
                 b.ReceiveFrom(_queuePath);
                 b.SetCreateMissingQueues(true);
                 b.SetPurgeOnStartup(true);
+
+                // Use dat json
+                b.UseJsonSerializer();

                 b.Subscribe(sbc => sbc.LoadHandlers());
             });


fix duplicate test names

fix duplicate test names

--- src/Compilers/Core/VBCSCompilerTests/CompilerServerTests.cs
+++ src/Compilers/Core/VBCSCompilerTests/CompilerServerTests.cs
@@ -1683,7 +1683,7 @@
         [WorkItem(545446, "DevDiv")]
         [Fact()]
         [Trait(Traits.Environment, Traits.Environments.VSProductInstall)]
-        public void Utf8Output_WithRedirecting_On_Shared()
+        public void Utf8Output_WithRedirecting_On_Shared_CS()
         {
             var srcFile = _tempDirectory.CreateFile("test.cs").WriteAllText("♕").Path;
             var tempOut = _tempDirectory.CreateFile("output.txt");
@@ -1701,7 +1701,7 @@
         [WorkItem(545446, "DevDiv")]
         [Fact()]
         [Trait(Traits.Environment, Traits.Environments.VSProductInstall)]
-        public void Utf8Output_WithRedirecting_On_Shared()
+        public void Utf8Output_WithRedirecting_On_Shared_VB()
         {
             var srcFile = _tempDirectory.CreateFile("test.vb").WriteAllText(@"♕").Path;
             var tempOut = _tempDirectory.CreateFile("output.txt");


chore: refactoring, comments

chore: refactoring, comments

--- src/CompressedStaticFiles/CompressedStaticFileMiddleware.cs
+++ src/CompressedStaticFiles/CompressedStaticFileMiddleware.cs
@@ -58,6 +58,7 @@
             var contentTypeProvider = staticFileOptions.Value.ContentTypeProvider ?? new FileExtensionContentTypeProvider();
             if (contentTypeProvider is FileExtensionContentTypeProvider fileExtensionContentTypeProvider)
             {
+                // the StaticFileProvider would not serve the file if it does not know the content-type
                 fileExtensionContentTypeProvider.Mappings[".br"] = "application/brotli";
             }
             staticFileOptions.Value.ContentTypeProvider = contentTypeProvider;
@@ -71,8 +72,11 @@
                     var fileExtension = compressionTypes[compressionType];
                     if (ctx.File.Name.EndsWith(fileExtension, StringComparison.OrdinalIgnoreCase))
                     {
+                        // we need to restore the original content type, otherwise it would be based on the compression type
+                        // (for example "application/brotli" instead of "text/html")
                         string contentType = null;
-                        if (contentTypeProvider.TryGetContentType(ctx.File.PhysicalPath.Remove(ctx.File.PhysicalPath.Length - fileExtension.Length, fileExtension.Length), out contentType))
+                        if (contentTypeProvider.TryGetContentType(ctx.File.PhysicalPath.Remove(
+                            ctx.File.PhysicalPath.Length - fileExtension.Length, fileExtension.Length), out contentType))
                             ctx.Context.Response.ContentType = contentType;
                         ctx.Context.Response.Headers.Add("Content-Encoding", new[] { compressionType });
                     }
@@ -91,9 +95,6 @@

         private void ProcessRequest(HttpContext context)
         {
-            string acceptEncoding = context.Request.Headers["Accept-Encoding"];
-            string[] browserSupportedCompressionTypes = context.Request.Headers["Accept-Encoding"].Select(s => s).ToArray();
-
             var fileSystem = _staticFileOptions.Value.FileProvider;
             var originalFile = fileSystem.GetFileInfo(context.Request.Path);

@@ -101,24 +102,39 @@
             {
                 return;
             }
+
+            var supportedEncodings = GetSupportedEncodings(context);

+            // try to find a compressed version of the file and ensure that it is smaller than the uncompressed version
             IFileInfo matchedFile = originalFile;
-            foreach (var compressionType in compressionTypes.Keys.Intersect(browserSupportedCompressionTypes, StringComparer.OrdinalIgnoreCase))
-            {
+            foreach (var compressionType in supportedEncodings)
+            {
                 var fileExtension = compressionTypes[compressionType];
                 var file = fileSystem.GetFileInfo(context.Request.Path + fileExtension);
                 if (file.Exists && file.Length < matchedFile.Length)
-                {
+                {
                     matchedFile = file;
-                }
+                }
             }

             if (matchedFile != originalFile)
             {
+                // a compressed version exists and is smaller, change the path to serve the compressed file
                 var matchedPath = context.Request.Path.Value + Path.GetExtension(matchedFile.Name);
                 _logger.LogFileServed(context.Request.Path.Value, matchedPath, originalFile.Length, matchedFile.Length);
                 context.Request.Path = new PathString(matchedPath);
-            }
+            }
+        }
+
+        /// <summary>
+        /// Find the encodings that are supported by the browser and by this middleware
+        /// </summary>
+        private static IEnumerable<string> GetSupportedEncodings(HttpContext context)
+        {
+            string acceptEncoding = context.Request.Headers["Accept-Encoding"];
+            var browserSupportedCompressionTypes = context.Request.Headers["Accept-Encoding"].Select(s => s);
+            var validCompressionTypes = compressionTypes.Keys.Intersect(browserSupportedCompressionTypes, StringComparer.OrdinalIgnoreCase);
+            return validCompressionTypes;
         }
     }
 }