Add back links to course and student

Add back links to course and student

--- src/ContosoUniversity.Website/Views/Instructor/Index.cshtml
+++ src/ContosoUniversity.Website/Views/Instructor/Index.cshtml
@@ -85,7 +85,7 @@
                     Select

-                    <display asp-for="@item.CourseID" />
+                    <display asp-for="@item.CourseID" />

                     <display asp-for="@item.Title" />
@@ -113,7 +113,7 @@
         {

-                    <display asp-for="@item.Student.FullName" />
+                    <display asp-for="@item.Student.FullName" />

                     <display asp-for="@item.Grade" />


Change default value for RemoveLoggerFactoryFilter to true (#521)

--- src/NLog.Extensions.Logging/Logging/NLogProviderOptions.cs
+++ src/NLog.Extensions.Logging/Logging/NLogProviderOptions.cs
@@ -60,7 +60,7 @@
         /// Resets the default Microsoft LoggerFactory Filter for the <see cref="NLogLoggerProvider"/>, and instead only uses NLog LoggingRules.
         /// </summary>
         /// <remarks>This option affects the building of service configuration, so assigning it from appsettings.json has no effect (loaded after).</remarks>
-        public bool RemoveLoggerFactoryFilter { get; set; }
+        public bool RemoveLoggerFactoryFilter { get; set; } = true;

         /// <summary>
         /// Replace Microsoft LoggerFactory with a pure <see cref="NLogLoggerFactory" />, and disables Microsoft Filter Logic and multiple LoggingProvider support.


[DatabaseSource] Improve NeedsReloadWhenFieldChanged code

--- src/Core/Banshee.Services/Banshee.Sources/DatabaseSource.cs
+++ src/Core/Banshee.Services/Banshee.Sources/DatabaseSource.cs
@@ -188,21 +188,25 @@
                 return true;

             // If it's the artist or album name, then we care, since it affects the browser
+            // FIXME this should be based on what filters (aka browsers) are active.  InternetRadio,
+            // for example, has only a Genre filter.
             if (field == Banshee.Query.BansheeQuery.ArtistField || field == Banshee.Query.BansheeQuery.AlbumField) {
                 return true;
             }

-            ISortableColumn sort_column = (TrackModel is DatabaseTrackListModel)
-                ? (TrackModel as DatabaseTrackListModel).SortColumn : null;
+            if (DatabaseTrackModel == null) {
+                Log.Error ("DatabaseTrackModel should not be null in DatabaseSource.NeedsReloadWhenFieldChanged");
+                return false;
+            }

             // If it's the field we're sorting by, then yes, we care
+            var sort_column = DatabaseTrackModel.SortColumn;
             if (sort_column != null && sort_column.Field == field) {
                 return true;
             }

             // Make sure the query isn't dependent on this field
-            QueryNode query = (TrackModel is DatabaseTrackListModel)
-                ? (TrackModel as DatabaseTrackListModel).Query : null;
+            QueryNode query = DatabaseTrackModel.Query;
             if (query != null) {
                 if (query != last_query) {
                     query_fields = new List<QueryField> (query.GetFields ());


Added a SendMessage method to send text to the client (mostly to help with debugging at this point).

--- src/OpenClassic.Server/Networking/Rscd/RscdPacketWriter.cs
+++ src/OpenClassic.Server/Networking/Rscd/RscdPacketWriter.cs
@@ -196,6 +196,15 @@

             CreatePacket(session, 209);
             // TODO: Finish
+        }
+
+        public void SendMessage(ISession session, string message)
+        {
+            Debug.Assert(session != null);
+
+            CreatePacket(session, 48);
+            WriteBytes(session, Encoding.UTF8.GetBytes(message));
+            FormatPacket(session);
         }

         #region Update packets


Added another test around the sql command splitter

--- src/DbUp.Tests/Support/SqlServer/SqlCommandSplitterTests.cs
+++ src/DbUp.Tests/Support/SqlServer/SqlCommandSplitterTests.cs
@@ -55,6 +55,13 @@

             var sqlCommandWithSingleLineCommentWithEndDashes = sqlBuilder.ToString();
             sqlBuilder.Clear();
+
+            // Sql command with a single line comment (with end dashes) containing a GO.
+            sqlBuilder.AppendLine("INSERT INTO TABLE [Foo] ([Text)");
+            sqlBuilder.AppendLine("VALUES (N'Some text. /*Strangely Emphasised Text*/ More text')");
+
+            var strangeInsert = sqlBuilder.ToString();
+            sqlBuilder.Clear();

             // Combine into one SQL statement seperated with GO.
             sqlBuilder.AppendLine(sqlCommandWithMultiLineComment);
@@ -62,6 +69,8 @@
             sqlBuilder.AppendLine(sqlCommandWithSingleLineComment);
             sqlBuilder.AppendLine(sqlGoWithTerminator);
             sqlBuilder.AppendLine(sqlCommandWithSingleLineCommentWithEndDashes);
+            sqlBuilder.AppendLine(sqlGo);
+            sqlBuilder.AppendLine(strangeInsert);

             var sqlText = sqlBuilder.ToString();
             Console.WriteLine("===== Splitting the following SQL =============");
@@ -78,12 +87,13 @@
                 Console.WriteLine("=======================================");
             }
             Assert.That(sqlCommands, Is.Not.Null);
-            Assert.That(sqlCommands.Count(), Is.EqualTo(3));
+            Assert.That(sqlCommands.Count(), Is.EqualTo(4));

             // I compare the original sql text with the commands but remove whitespace characters as the parser is trimming some whitespace in some instances.
             Assert.That(sqlCommands[0].Trim(), Is.EqualTo(sqlCommandWithMultiLineComment.Trim()));
             Assert.That(sqlCommands[1].Trim(), Is.EqualTo(sqlCommandWithSingleLineComment.Trim()));
             Assert.That(sqlCommands[2].Trim(), Is.EqualTo(sqlCommandWithSingleLineCommentWithEndDashes.Trim()));
+            Assert.That(sqlCommands[3].Trim(), Is.EqualTo(strangeInsert.Trim()));
         }

     }


Delete unused support in ResettableDelay for taking a task scheduler

Nothing used this, so to simplify we'll remove it.

--- src/EditorFeatures/Core/Shared/Utilities/ResettableDelay.cs
+++ src/EditorFeatures/Core/Shared/Utilities/ResettableDelay.cs
@@ -25,8 +25,7 @@
         /// delay can be reset multiple times.
         /// </summary>
         /// <param name="delayInMilliseconds">The time to delay before completing the task</param>
-        /// <param name="foregroundTaskScheduler">Optional.  If used, the delay won't start until the supplied TaskScheduler schedules the delay to begin.</param>
-        public ResettableDelay(int delayInMilliseconds, IExpeditableDelaySource expeditableDelaySource, TaskScheduler? foregroundTaskScheduler = null)
+        public ResettableDelay(int delayInMilliseconds, IExpeditableDelaySource expeditableDelaySource)
         {
             Contract.ThrowIfFalse(delayInMilliseconds >= 50, "Perf, only use delays >= 50ms");
             _delayInMilliseconds = delayInMilliseconds;
@@ -34,14 +33,7 @@
             _taskCompletionSource = new TaskCompletionSource<object?>();
             Reset();

-            if (foregroundTaskScheduler != null)
-            {
-                Task.Factory.SafeStartNew(() => StartTimerAsync(expeditableDelaySource, continueOnCapturedContext: true), CancellationToken.None, foregroundTaskScheduler);
-            }
-            else
-            {
-                _ = StartTimerAsync(expeditableDelaySource, continueOnCapturedContext: false);
-            }
+            _ = StartTimerAsync(expeditableDelaySource);
         }

         private ResettableDelay()
@@ -63,12 +55,12 @@
             _lastSetTime = Environment.TickCount;
         }

-        private async Task StartTimerAsync(IExpeditableDelaySource expeditableDelaySource, bool continueOnCapturedContext)
+        private async Task StartTimerAsync(IExpeditableDelaySource expeditableDelaySource)
         {
             do
             {
                 // Keep delaying until at least delayInMilliseconds has elapsed since lastSetTime
-                if (!await expeditableDelaySource.Delay(TimeSpan.FromMilliseconds(_delayInMilliseconds), CancellationToken.None).ConfigureAwait(continueOnCapturedContext))
+                if (!await expeditableDelaySource.Delay(TimeSpan.FromMilliseconds(_delayInMilliseconds), CancellationToken.None).ConfigureAwait(false))
                 {
                     // The operation is being expedited.
                     break;


Show and hide Glyph using events not overrides

--- src/GitHub.InlineReviews/Tags/AddInlineCommentGlyph.xaml.cs
+++ src/GitHub.InlineReviews/Tags/AddInlineCommentGlyph.xaml.cs
@@ -1,6 +1,5 @@
 using System;
 using System.Windows.Controls;
-using System.Windows.Input;

 namespace GitHub.InlineReviews.Tags
 {
@@ -9,19 +8,10 @@
         public AddInlineCommentGlyph()
         {
             InitializeComponent();
+
             Visibility = System.Windows.Visibility.Hidden;
-        }
-
-        protected override void OnMouseEnter(MouseEventArgs e)
-        {
-            Visibility = System.Windows.Visibility.Visible;
-            base.OnMouseEnter(e);
-        }
-
-        protected override void OnMouseLeave(MouseEventArgs e)
-        {
-            Visibility = System.Windows.Visibility.Hidden;
-            base.OnMouseLeave(e);
+            MouseEnter += (s, e) => Visibility = System.Windows.Visibility.Visible;
+            MouseLeave += (s, e) => Visibility = System.Windows.Visibility.Hidden;
         }
     }
 }


include properties collection when cloning ApiResource #3013

--- src/IdentityServer4/src/Extensions/ApiResourceExtensions.cs
+++ src/IdentityServer4/src/Extensions/ApiResourceExtensions.cs
@@ -16,9 +16,10 @@
                 Enabled = apiResource.Enabled,
                 Name = apiResource.Name,
                 DisplayName = apiResource.DisplayName,
-                ApiSecrets = apiResource.ApiSecrets,
+                ApiSecrets = new HashSet<Secret>(apiResource.ApiSecrets),
                 Scopes = new HashSet<Scope>(scopes.ToArray()),
-                UserClaims = apiResource.UserClaims
+                UserClaims = new HashSet<string>(apiResource.UserClaims),
+                Properties = new Dictionary<string, string>(apiResource.Properties)
             };
         }
     }


Reset focus after opening the FileOpenDialog.

--- src/Sarif.Viewer.VisualStudio/CodeAnalysisResultManager.cs
+++ src/Sarif.Viewer.VisualStudio/CodeAnalysisResultManager.cs
@@ -6,6 +6,8 @@
 using System.Diagnostics.CodeAnalysis;
 using System.IO;
 using System.Runtime.InteropServices;
+using System.Windows;
+using System.Windows.Input;

 using Microsoft.CodeAnalysis.Sarif;
 using Microsoft.CodeAnalysis.Sarif.Writers;
@@ -300,6 +302,12 @@
                 }
             }

+            // Save the element which currently has focus. Opening the OpenFileDialog
+            // causes the TreeView to lose focus, which in turn causes the TreeViewItem
+            // selection to be unpredictable (because the selection event relies on the
+            // TreeViewItem focus.
+            UIElement elementWithFocus = Keyboard.FocusedElement as UIElement;
+
             OpenFileDialog openFileDialog = new OpenFileDialog();

             string fullPath = Path.GetFullPath(fileName);
@@ -309,12 +317,25 @@
             openFileDialog.Filter = shortName + "|" + shortName;
             openFileDialog.RestoreDirectory = true;

-            if (!openFileDialog.ShowDialog().HasValue)
-            {
-                return fileName;
+            try
+            {
+                bool? dialogResult = openFileDialog.ShowDialog();
+
+                if (!dialogResult.HasValue || !dialogResult.Value)
+                {
+                    return fileName;
+                }
+            }
+            finally
+            {
+                if (elementWithFocus != null)
+                {
+                    elementWithFocus.Focus();
+                }
             }

             string resolvedPath = openFileDialog.FileName;
+
             string resolvedFileName = Path.GetFileName(resolvedPath);

             // If remapping has somehow altered the file name itself,


Fixing mono builds  (#4874)

 Fixing mono builds  (#4874)

* Fixing mono builds

* some improvements

* feedback

* Update version and PackageReleaseNotes

* undoing csproj

--- src/SdkCommon/ClientRuntime/ClientRuntime/ServiceClient.cs
+++ src/SdkCommon/ClientRuntime/ClientRuntime/ServiceClient.cs
@@ -55,6 +55,24 @@
         /// </summary>
         private string _fxVersion;

+        private bool IsMonoFramework
+        {
+            get {
+                bool result = false;
+#if FullNetFx
+                switch (Environment.OSVersion.Platform)
+                {
+                    case PlatformID.Unix:
+                    case PlatformID.MacOSX:
+                    case PlatformID.Xbox:
+                        result = true;
+                        break;
+                }
+#endif
+                return result;
+            }
+        }
+
         #region Full Net Fx specific code
 #if FullNetFx
         /// <summary>
@@ -113,16 +131,13 @@
         /// <returns>Value for provided HKLM key</returns>
         private string ReadHKLMRegistry(string path, string key)
         {
-            switch (Environment.OSVersion.Platform)
-            {
-                case PlatformID.Unix:
-                case PlatformID.MacOSX:
-                case PlatformID.Xbox:
+           try
+            {
+                if (IsMonoFramework)
+                {
                     return string.Empty;
-            }
-
-            try
-            {
+                }
+
                 using (RegistryKey rk = Registry.LocalMachine.OpenSubKey(path))
                 {
                     if (rk == null) return "";
@@ -146,8 +161,19 @@
                     _defaultUserAgentInfoList = new List<ProductInfoHeaderValue>();
                     _defaultUserAgentInfoList.Add(new ProductInfoHeaderValue(FXVERSION, FrameworkVersion));
 #if FullNetFx
-                    _defaultUserAgentInfoList.Add(new ProductInfoHeaderValue(OSNAME, OsName));
-                    _defaultUserAgentInfoList.Add(new ProductInfoHeaderValue(OSVERSION, OsVersion));
+                    if (!IsMonoFramework)
+                    {
+                        _defaultUserAgentInfoList.Add(new ProductInfoHeaderValue(OSNAME, OsName));
+                        _defaultUserAgentInfoList.Add(new ProductInfoHeaderValue(OSVERSION, OsVersion));
+                    }
+                    else
+                    {
+                        string monoOsName = Environment.OSVersion.Platform.ToString();
+                        if (!string.IsNullOrWhiteSpace(monoOsName))
+                        {
+                            _defaultUserAgentInfoList.Add(new ProductInfoHeaderValue(OSNAME, monoOsName));
+                        }
+                    }
 #endif
                 }


Fixes to CreateTable() methods

Fixes to CreateTable() methods

--- MagnaDB/MagnaDB.SQLite/MagnaModels.cs
+++ MagnaDB/MagnaDB.SQLite/MagnaModels.cs
@@ -3923,7 +3923,7 @@
                 }
                 keySB = keySB.Remove(keySB.Length - 1, 1);

-                temp.AppendFormat("\nPRIMARY KEY ({0})\n", keySB.ToString());
+                temp.AppendFormat(",\nPRIMARY KEY ({0})\n", keySB.ToString());
             }

             temp.Append(" )");
@@ -3982,7 +3982,7 @@
                 }
                 keySB = keySB.Remove(keySB.Length - 1, 1);

-                temp.AppendFormat("\nPRIMARY KEY ({0})\n", keySB.ToString());
+                temp.AppendFormat(",\nPRIMARY KEY ({0})\n", keySB.ToString());
             }

             temp.Append(" )");
@@ -4041,7 +4041,7 @@
                 }
                 keySB = keySB.Remove(keySB.Length - 1, 1);

-                temp.AppendFormat("\nPRIMARY KEY ({0})\n", keySB.ToString());
+                temp.AppendFormat(",\nPRIMARY KEY ({0})\n", keySB.ToString());
             }

             temp.Append(" )");


Fix redirect path

Fix redirect path

--- src/ServiceStack.ServiceInterface/AuthenticateAttribute.cs
+++ src/ServiceStack.ServiceInterface/AuthenticateAttribute.cs
@@ -73,7 +73,7 @@
                         var url = htmlRedirect;
                         if (url.SafeSubstring(0, 2) == "~/")
                         {
-                            url = req.GetBaseUrl() + url.Substring(2);
+                            url = req.GetBaseUrl().CombineWith(url.Substring(2));
                         }
                         url = url.AddQueryParam("redirect", req.AbsoluteUri);
                         res.RedirectToUrl(url);


Set up basic action control response deserialization.

--- src/Mono.Upnp/Mono.Upnp/Mono.Upnp.Internal/ControlClient.cs
+++ src/Mono.Upnp/Mono.Upnp/Mono.Upnp.Internal/ControlClient.cs
@@ -57,8 +57,16 @@
             request.Headers.Add ("SOAPACTION", string.Format ("{0}#{1}", service_type, actionName));
             Serializer.Serialize (new SoapEnvelope<ActionArguments> (new ActionArguments (service_type, actionName, arguments)), request.GetRequestStream ());
             using (var response = (HttpWebResponse)request.GetResponse ()) {
-                // TODO do stuff here
-                return null;
+                if (response.StatusCode == HttpStatusCode.OK) {
+                    using (var reader = XmlReader.Create (response.GetResponseStream ())) {
+                        reader.ReadToFollowing ("Envelope", Protocol.SoapEnvelopeSchema);
+                        var envelope = Deserializer.Deserialize<SoapEnvelope<ActionResult>> (reader);
+                        return envelope.Body;
+                    }
+                } else {
+                    // TODO handle else
+                    return null;
+                }
             }
         }
     }


Update LogCommand.cs

Update LogCommand.cs

- added userID to deleted messages log to aid discord.net/ discord issue where bot can't identify username#discriminator

--- src/NadekoBot/Modules/Administration/Commands/LogCommand.cs
+++ src/NadekoBot/Modules/Administration/Commands/LogCommand.cs
@@ -409,7 +409,7 @@
                 {
                     try
                     {
-                        var str = $@"🕔`{prettyCurrentTime}`👤`{msg.Author.Username}#{msg.Author.Discriminator}` **Deleted Message** 🆔 `{usr.Id}` #⃣ `{channel.Name}`
+                        var str = $@"🕔`{prettyCurrentTime}`👤`{msg.Author.Username}#{msg.Author.Discriminator}` **Deleted Message** 🆔 `{msg.Author.Id}` #⃣ `{channel.Name}`
 🗑 {msg.Resolve(userHandling: UserMentionHandling.NameAndDiscriminator)}";
                         if (msg.Attachments.Any())
                             str += $"{Environment.NewLine}📎 {string.Join(", ", msg.Attachments.Select(a => a.ProxyUrl))}";


Added comments to GetSymbolId()

Added comments to GetSymbolId()

--- src/SourceBrowser.Generator/Extensions/SymbolExtensions.cs
+++ src/SourceBrowser.Generator/Extensions/SymbolExtensions.cs
@@ -10,12 +10,15 @@
     public static class SymbolExtensions
     {

+        /// <summary>
+        /// Returns the SymbolId for a symbol. SymbolId is very closely
+        /// related to DocumentationCommentId, with some minor changes.
+        /// </summary>
         public static string GetSymbolId(this ISymbol symbol)
         {
             string documentationCommentId = String.Empty;
             symbol = symbol.OriginalDefinition;
             documentationCommentId = symbol.GetDocumentationCommentId();
-
             documentationCommentId = documentationCommentId.Replace("#ctor", "ctor");

             return documentationCommentId;


Fixed extension method visibility.

Fixed extension method visibility.

--- src/Nimbus/Configuration/ComponentRegistrationExtensions.cs
+++ src/Nimbus/Configuration/ComponentRegistrationExtensions.cs
@@ -12,7 +12,7 @@
 {
     internal static class ComponentRegistrationExtensions
     {
-        public static void RegisterPropertiesFromConfigurationObject(this PoorMansIoC container, INimbusConfiguration configuration)
+        internal static void RegisterPropertiesFromConfigurationObject(this PoorMansIoC container, INimbusConfiguration configuration)
         {
             configuration.RegisterWith(container);

@@ -38,7 +38,7 @@
                 .Done();
         }

-        public static IEnumerable<string> ValidationErrors(this IValidatableConfigurationSetting o)
+        internal static IEnumerable<string> ValidationErrors(this IValidatableConfigurationSetting o)
         {
             foreach (var validationError in o.Validate()) yield return validationError;

@@ -61,7 +61,7 @@
             }
         }

-        public static void AssertConfigurationIsValid(this IValidatableConfigurationSetting configuration)
+        internal static void AssertConfigurationIsValid(this IValidatableConfigurationSetting configuration)
         {
             var validationErrors = configuration.ValidationErrors().ToArray();
             if (validationErrors.None()) return;


#18315: Fixing fields rendering

#18315: Fixing fields rendering

Work Iten: 18315

--HG--
branch : 1.x

--- src/Orchard/ContentManagement/Drivers/ContentFieldDriver.cs
+++ src/Orchard/ContentManagement/Drivers/ContentFieldDriver.cs
@@ -127,8 +127,8 @@
             ShapeMetadata metadata = shape.Metadata;

             // if no ContentField property has been set, assign it
-            if (shape.ContentPart == null) {
-                shape.ContentPart = ctx.ContentField;
+            if (shape.ContentField == null) {
+                shape.ContentField = ctx.ContentField;
             }

             // if no ContentPart property has been set, assign it
@@ -143,8 +143,10 @@

             var shapeType = metadata.Type;
             var fieldName = differentiator ?? String.Empty;
-            var partName = shape.ContentPart.PartDefinition.Name;
-            var contentType = shape.ContentItem.ContentType;
+            string partName = shape.ContentPart.PartDefinition.Name;
+            string contentType = shape.ContentItem.ContentType;
+
+            // whether the content type has been created dynamically or not
             var dynamicType = string.Equals(partName, contentType, StringComparison.Ordinal);

             // [ShapeType__FieldName] e.g. Fields/Common.Text-Teaser


add fling

add fling

--- Mapsui.UI.Forms/Utils/FlingTracker.cs
+++ Mapsui.UI.Forms/Utils/FlingTracker.cs
@@ -5,7 +5,7 @@
 {
     public class FlingTracker
     {
-        const int maxSize = 2;
+        const int maxSize = 50;
         const long maxTicks = 200 * 10000;  // Use only events from the last 200 ms

         readonly Dictionary<long, Queue<(double x, double y, long time)>> events;
@@ -26,9 +26,10 @@
             events[id].Enqueue((location.X, location.Y, ticks));

             // Check, if we at the end of array
-            if (events[id].Count > maxSize)
+            if (events[id].Count > 2)
             {
-                events[id].Dequeue();
+                while (events[id].Count > maxSize || events[id].Peek().time < (ticks - maxTicks))
+                    events[id].Dequeue();
             }
         }

@@ -48,27 +49,38 @@

         public (double vx, double vy) CalcVelocity(long id, long now)
         {
-            double velocityX = 0;
-            double velocityY = 0;
+            double distanceX = 0;
+            double distanceY = 0;

-            if (!events.ContainsKey(id) || events[id].Count != 2)
+            if (!events.ContainsKey(id) || events[id].Count < 2)
                 return (0d, 0d);

             var eventQueue = events[id];
             var eventsArray = eventQueue.ToArray();

-            (var lastX, var lastY, var lastTime) = eventsArray[0];
-            (var nowX, var nowY, var nowTime) = eventsArray[1];
+            (_, _, var firstTime) = eventsArray[0];

-            // Only calc velocities for last maxTicks ticks
-            if (now - lastTime < maxTicks)
+            long finalTime = 0;
+
+            for (var i = 1; id < eventsArray.Length; i ++)
             {
-                // Calc velocity in pixel per sec
-                velocityX = (nowX - lastX) * 10000000 / (nowTime - lastTime);
-                velocityY = (nowY - lastY) * 10000000 / (nowTime - lastTime);
+                (var lastX, var lastY, var lastTime) = eventsArray[i - 1];
+                (var nowX, var nowY, var nowTime) = eventsArray[i];
+
+                // Only calc velocities for last maxTicks ticks
+                if (now - lastTime < maxTicks)
+                {
+                    // Calc velocity in pixel per sec
+                    distanceX = (nowX - lastX) * 10000000;// / (nowTime - lastTime);
+                    distanceY = (nowY - lastY) * 10000000;// / (nowTime - lastTime);
+                }
+
+                finalTime = nowTime;
             }
+
+            var totalTime = finalTime - firstTime;

-            return (velocityX, velocityY);
+            return (distanceX / totalTime, distanceY / totalTime);
         }
     }
 }


Hang fix

Hang fix

--- src/PackageManagement.VisualStudio/IDE/VSSolutionManager.cs
+++ src/PackageManagement.VisualStudio/IDE/VSSolutionManager.cs
@@ -1,21 +1,17 @@
-using EnvDTE;
-using EnvDTE80;
-using Microsoft.VisualStudio;
-using Microsoft.VisualStudio.Shell;
-using Microsoft.VisualStudio.Shell.Interop;
-using NuGet.PackageManagement;
-using NuGet.ProjectManagement;
-using System;
+using System;
 using System.Collections.Generic;
 using System.ComponentModel.Composition;
 using System.Diagnostics;
 using System.IO;
 using System.Linq;
 using System.Runtime.InteropServices;
-using System.Text;
-using System.Threading;
-using System.Threading.Tasks;
 using System.Windows;
+using EnvDTE;
+using EnvDTE80;
+using Microsoft.VisualStudio;
+using Microsoft.VisualStudio.Shell;
+using Microsoft.VisualStudio.Shell.Interop;
+using NuGet.ProjectManagement;
 using EnvDTEProject = EnvDTE.Project;

 namespace NuGet.PackageManagement.VisualStudio
@@ -29,10 +25,42 @@
         private readonly IVsMonitorSelection _vsMonitorSelection;
         private readonly uint _solutionLoadedUICookie;
         private readonly IVsSolution _vsSolution;
-        private bool _initNeeded;
+        private bool _initialized;
+
         private NuGetAndEnvDTEProjectCache NuGetAndEnvDTEProjectCache { get; set; }

-        private ManualResetEvent _initFinished;
+        private bool IsSolutionOpening { get; set; }
+
+        public INuGetProjectContext NuGetProjectContext { get; set; }
+
+        public NuGetProject DefaultNuGetProject
+        {
+            get
+            {
+                Init();
+
+                if (String.IsNullOrEmpty(DefaultNuGetProjectName))
+                {
+                    return null;
+                }
+
+                NuGetProject defaultNuGetProject;
+                NuGetAndEnvDTEProjectCache.TryGetNuGetProject(DefaultNuGetProjectName, out defaultNuGetProject);
+                return defaultNuGetProject;
+            }
+        }
+
+        public string DefaultNuGetProjectName { get; set; }
+
+        public event EventHandler<NuGetProjectEventArgs> NuGetProjectAdded;
+        public event EventHandler<NuGetProjectEventArgs> NuGetProjectRemoved;
+        public event EventHandler<NuGetProjectEventArgs> NuGetProjectRenamed;
+
+        public event EventHandler SolutionClosed;
+        public event EventHandler SolutionClosing;
+        public event EventHandler SolutionOpened;
+        public event EventHandler SolutionOpening;
+

         public VSSolutionManager()
             : this(
@@ -42,14 +70,13 @@
         {
         }

-        public VSSolutionManager(DTE dte, IVsSolution vsSolution, IVsMonitorSelection vsMonitorSelection)
+        private VSSolutionManager(DTE dte, IVsSolution vsSolution, IVsMonitorSelection vsMonitorSelection)
         {
             if (dte == null)
             {
                 throw new ArgumentNullException("dte");
             }

-            _initNeeded = true;
             _dte = dte;
             _vsSolution = vsSolution;
             _vsMonitorSelection = vsMonitorSelection;
@@ -68,43 +95,21 @@
                 ErrorHandler.ThrowOnFailure(hr);
             }

-            IsSolutionOpening = false;
             _solutionEvents.BeforeClosing += OnBeforeClosing;
             _solutionEvents.AfterClosing += OnAfterClosing;
             _solutionEvents.ProjectAdded += OnEnvDTEProjectAdded;
             _solutionEvents.ProjectRemoved += OnEnvDTEProjectRemoved;
             _solutionEvents.ProjectRenamed += OnEnvDTEProjectRenamed;
-
-            // Run the init on another thread to avoid an endless loop of SolutionManager -> Project System -> VSPackageManager -> SolutionManager
-            // TODO: fix the cyclic reference problem; then remove _initFinished.
-            _initFinished = new ManualResetEvent(false);
-            ThreadPool.QueueUserWorkItem(new WaitCallback(Init));
-        }
-
-        public NuGetProject DefaultNuGetProject
-        {
-            get
-            {
-                if (String.IsNullOrEmpty(DefaultNuGetProjectName))
-                {
-                    return null;
-                }
-                NuGetProject defaultNuGetProject;
-                NuGetAndEnvDTEProjectCache.TryGetNuGetProject(DefaultNuGetProjectName, out defaultNuGetProject);
-                return defaultNuGetProject;
-            }
-        }
-
-        public string DefaultNuGetProjectName
-        {
-            get;
-            set;
         }

         public NuGetProject GetNuGetProject(string nuGetProjectSafeName)
         {
-            // wait for Init() to finish so that NuGetAndEnvDTEProjectCache is created.
-            _initFinished.WaitOne();
+            if (string.IsNullOrEmpty(nuGetProjectSafeName))
+            {
+                throw new ArgumentException(ProjectManagement.Strings.Argument_Cannot_Be_Null_Or_Empty, "nuGetProjectSafeName");
+            }
+
+            Init();

             NuGetProject nuGetProject = null;
             // NuGetAndEnvDTEProjectCache could be null when solution is not open.
@@ -121,6 +126,8 @@
             {
                 throw new ArgumentNullException("nuGetProject");
             }
+
+            Init();

             // Try searching for simple names first
             string name = nuGetProject.GetMetadata<string>(NuGetProjectMetadataKeys.UniqueName);
@@ -133,8 +140,12 @@

         public Project GetDTEProject(string nuGetProjectSafeName)
         {
-            // wait for Init() to finish so that NuGetAndEnvDTEProjectCache is created.
-            _initFinished.WaitOne();
+            if (string.IsNullOrEmpty(nuGetProjectSafeName))
+            {
+                throw new ArgumentException(ProjectManagement.Strings.Argument_Cannot_Be_Null_Or_Empty, "nuGetProjectSafeName");
+            }
+
+            Init();

             Project dteProject;
             NuGetAndEnvDTEProjectCache.TryGetDTEProject(nuGetProjectSafeName, out dteProject);
@@ -143,7 +154,9 @@

         public IEnumerable<NuGetProject> GetNuGetProjects()
         {
-            if(IsSolutionOpen)
+            Init();
+
+            if (IsSolutionOpen)
             {
                 EnsureNuGetAndEnvDTEProjectCache();
                 return NuGetAndEnvDTEProjectCache.GetNuGetProjects();
@@ -154,7 +167,7 @@

         internal IEnumerable<EnvDTEProject> GetEnvDTEProjects()
         {
-            if(IsSolutionOpen)
+            if (IsSolutionOpen)
             {
                 EnsureNuGetAndEnvDTEProjectCache();
                 return NuGetAndEnvDTEProjectCache.GetEnvDTEProjects();
@@ -175,20 +188,6 @@
             }
         }

-        private bool IsSolutionOpening
-        {
-            get;
-            set;
-        }
-
-        public event EventHandler<NuGetProjectEventArgs> NuGetProjectAdded;
-        public event EventHandler<NuGetProjectEventArgs> NuGetProjectRemoved;
-        public event EventHandler<NuGetProjectEventArgs> NuGetProjectRenamed;
-
-        public event EventHandler SolutionClosed;
-
-        public event EventHandler SolutionClosing;
-
         public string SolutionDirectory
         {
             get
@@ -234,9 +233,6 @@
             return solutionFilePath;
         }

-        public event EventHandler SolutionOpened;
-        public event EventHandler SolutionOpening;
-
         /// <summary>
         /// Checks whether the current solution is saved to disk, as opposed to be in memory.
         /// </summary>
@@ -272,8 +268,6 @@

         private void OnSolutionOpened()
         {
-            // we can skip the init if this has already been called
-            _initNeeded = false;
             IsSolutionOpening = true;
             if (SolutionOpening != null)
             {
@@ -322,7 +316,7 @@
             {
                 EnsureNuGetAndEnvDTEProjectCache();

-                if(EnvDTEProjectUtility.IsSupported(envDTEProject))
+                if (EnvDTEProjectUtility.IsSupported(envDTEProject))
                 {
                     RemoveEnvDTEProjectFromCache(oldName);
                     AddEnvDTEProjectToCache(envDTEProject);
@@ -459,22 +453,24 @@
             }
         }

-        private void Init(object state)
+        private void Init()
         {
             try
             {
-                if (_initNeeded && _dte.Solution.IsOpen)
-                {
-                    OnSolutionOpened();
-                }
-            }
-            catch (Exception)
-            {
-            }
-            finally
-            {
-                // siginal that Init is finished
-                _initFinished.Set();
+                if (!_initialized)
+                {
+                    _initialized = true;
+
+                    if (_dte.Solution.IsOpen)
+                    {
+                        OnSolutionOpened();
+                    }
+                }
+            }
+            catch (Exception ex)
+            {
+                // ignore errors
+                Debug.Fail(ex.ToString());
             }
         }

@@ -497,12 +493,14 @@

         internal IDictionary<string, List<EnvDTEProject>> GetDependentEnvDTEProjectsDictionary()
         {
+            Init();
+
             var dependentEnvDTEProjectsDictionary = new Dictionary<string, List<Project>>();

             // Get all of the projects in the solution and build the reverse graph. i.e.
             // if A has a project reference to B (A -> B) the this will return B -> A
             // We need to run this on the ui thread so that it doesn't freeze for websites. Since there might be a
-            // large number of references.
+            // large number of references.
             ThreadHelper.Generic.Invoke(() =>
             {
                 foreach (EnvDTEProject envDTEProj in GetEnvDTEProjects())
@@ -560,13 +558,6 @@
             return VSConstants.S_OK;
         }

-        #endregion
-
-
-        public INuGetProjectContext NuGetProjectContext
-        {
-            get;
-            set;
-        }
+        #endregion
     }
 }


diag: unknown function not reported for indirect function call

--- src/Peachpie.CodeAnalysis/FlowAnalysis/DiagnosingVisitor.cs
+++ src/Peachpie.CodeAnalysis/FlowAnalysis/DiagnosingVisitor.cs
@@ -47,7 +47,7 @@

         private void CheckUndefinedFunctionCall(BoundGlobalFunctionCall x)
         {
-            if (x.TargetMethod == null)
+            if (x.TargetMethod == null && x.Name.IsDirect)
             {
                 _diagnostics.Add(x, ErrorCode.WRN_UndefinedFunctionCall, x.Name.NameValue.ToString());
             }


Added static variables in generator methods diagnostic.

--- src/Peachpie.CodeAnalysis/FlowAnalysis/DiagnosingVisitor.cs
+++ src/Peachpie.CodeAnalysis/FlowAnalysis/DiagnosingVisitor.cs
@@ -172,6 +172,16 @@
             }
         }

+        public override void VisitStaticStatement(BoundStaticVariableStatement x)
+        {
+            // TODO: Remove once fix for static variables handling in methods with unoptimized locals is done.
+            if ((_routine.Flags & RoutineFlags.IsGenerator) == RoutineFlags.IsGenerator)
+            {
+                _diagnostics.Add(_routine, x.PhpSyntax, ErrorCode.ERR_NotYetImplemented, "Having static variables in generator methods");
+            }
+            base.VisitStaticStatement(x);
+        }
+
         public override void VisitYield(BoundYieldEx boundYieldEx)
         {
             // TODO: Start supporting yielding from exception handling constructs.


Issue #70 Запрет подключения классов в некорректными именами

--- src/ScriptEngine/Machine/Contexts/AttachedScriptsFactory.cs
+++ src/ScriptEngine/Machine/Contexts/AttachedScriptsFactory.cs
@@ -18,6 +18,9 @@

         public ModuleHandle AttachByPath(CompilerService compiler, string path, string typeName)
         {
+            if (!Utils.IsValidIdentifier(typeName))
+                throw RuntimeException.InvalidArgumentValue();
+
             ThrowIfTypeExist(typeName);

             var code = _engine.Loader.FromFile(path);


Move set-up and config code into t/c/f block - this will handle 'unhandled exeptions' that hapen outside of the OWIN pipeline.

--- src/Services/Experimentation/Experimentation.Api/Program.cs
+++ src/Services/Experimentation/Experimentation.Api/Program.cs
@@ -12,23 +12,23 @@
     {
         public static void Main(string[] args)
         {
-            var env = $"appsettings.{Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT") ?? "Production"}";
-
-            var builder = new ConfigurationBuilder()
-                .SetBasePath(Directory.GetCurrentDirectory())
-                .AddJsonFile("appsettings.json", optional: false, reloadOnChange: true)
-                .AddJsonFile($"appsettings.{env}.json", optional: true)
-                .AddEnvironmentVariables()
-                .Build();
-
-            Log.Logger = new LoggerConfiguration()
-                .Enrich.FromLogContext()
-                .MinimumLevel.Debug()
-                .WriteTo.RollingFile(new JsonFormatter(), "Logs/log-{Date}.json")
-                .CreateLogger();
-
             try
             {
+                var env = $"appsettings.{Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT") ?? "Production"}";
+
+                var builder = new ConfigurationBuilder()
+                    .SetBasePath(Directory.GetCurrentDirectory())
+                    .AddJsonFile("appsettings.json", optional: false, reloadOnChange: true)
+                    .AddJsonFile($"appsettings.{env}.json", optional: true)
+                    .AddEnvironmentVariables()
+                    .Build();
+
+                Log.Logger = new LoggerConfiguration()
+                    .Enrich.FromLogContext()
+                    .MinimumLevel.Debug()
+                    .WriteTo.RollingFile(new JsonFormatter(), "Logs/log-{Date}.json")
+                    .CreateLogger();
+
                 Log.Information("Firing up the experimentation api...");
                 BuildWebHost(args, builder).Run();
             }


Update src/System.Net.Http/tests/StressTests/HttpStress/Program.cs

Co-Authored-By: Stephen Toub <94274d0b635748ad8df96c0fc4f19e1ecd3f67e2@microsoft.com>

--- src/System.Net.Http/tests/StressTests/HttpStress/Program.cs
+++ src/System.Net.Http/tests/StressTests/HttpStress/Program.cs
@@ -565,7 +565,7 @@
                     return new Random(Seed: Combine(taskNum, seed));
                 }

-                var random = CreateRandomInstance();
+                Random random = CreateRandomInstance();

                 for (long i = taskNum; ; i++)
                 {


Fix failing httplistener tests on Win7.

Fix failing httplistener tests on Win7.

--- src/System.Net.HttpListener/tests/HttpRequestStreamTests.cs
+++ src/System.Net.HttpListener/tests/HttpRequestStreamTests.cs
@@ -25,10 +25,7 @@
         {
             _factory = new HttpListenerFactory();
             _listener = _factory.GetListener();
-            if (!PlatformDetection.IsWindows7)
-            {
-                _helper = new GetContextHelper(_listener, _factory.ListeningUrl);
-            }
+            _helper = new GetContextHelper(_listener, _factory.ListeningUrl);
         }

         public void Dispose()
@@ -392,7 +389,7 @@
         {
             HttpListenerRequest request1 = await _helper.GetRequest();
             HttpListenerRequest request2 = await _helper.GetRequest();
-
+
             using (Stream inputStream1 = request1.InputStream)
             using (Stream inputStream2 = request2.InputStream)
             {
@@ -478,4 +475,3 @@
         }
     }
 }
-


Removed ActiveIssue attributes for #5234.

--- src/System.Net.Sockets/tests/FunctionalTests/SendReceive.cs
+++ src/System.Net.Sockets/tests/FunctionalTests/SendReceive.cs
@@ -383,14 +383,12 @@
             Assert.Equal(sentChecksum.Sum, receivedChecksum.Sum);
         }

-        [ActiveIssue(5234, PlatformID.Windows)]
         [Fact]
         public void SendToRecvFromAsync_Single_Datagram_UDP_IPv6()
         {
             SendToRecvFromAsync_Datagram_UDP(IPAddress.IPv6Loopback, IPAddress.IPv6Loopback);
         }

-        [ActiveIssue(5234, PlatformID.Windows)]
         [Fact]
         public void SendToRecvFromAsync_Single_Datagram_UDP_IPv4()
         {
@@ -428,7 +426,6 @@
         }

         [Fact]
-        [ActiveIssue(5234, PlatformID.Windows)]
         public void SendRecvAsync_TcpListener_TcpClient_IPv4()
         {
             SendRecvAsync_TcpListener_TcpClient(IPAddress.Loopback);


Making context commands as disposable

Making context commands as disposable

--- src/Take.Blip.Client/Extensions/Context/ContextExtension.cs
+++ src/Take.Blip.Client/Extensions/Context/ContextExtension.cs
@@ -40,7 +40,8 @@

             var requestCommand = CreateSetCommandRequest(
                 document,
-                uriPath
+                uriPath,
+                id: $"disposable:{EnvelopeId.NewId()}"
                 );

             return ProcessCommandAsync(requestCommand, cancellationToken);
@@ -56,7 +57,7 @@
             if (variableName == null) throw new ArgumentNullException(nameof(variableName));

             var uriPath = GetVariableRequestUri(identity, variableName);
-            var requestCommand = CreateDeleteCommandRequest(uriPath);
+            var requestCommand = CreateDeleteCommandRequest(uriPath, id: $"disposable:{EnvelopeId.NewId()}");

             return ProcessCommandAsync(requestCommand, cancellationToken);
         }


Fix DM cancellation/failure announcement timing

--- src/Tgstation.Server.Host/Components/Compiler/DreamMaker.cs
+++ src/Tgstation.Server.Host/Components/Compiler/DreamMaker.cs
@@ -267,6 +267,7 @@
 				Status = CompilerStatus.Copying;
 			}

+			var announced = false;
 			try
 			{
 				var commitInsert = revisionInformation.CommitSha.Substring(0, 7);
@@ -291,16 +292,13 @@
 				using (var byondLock = await byond.UseExecutables(null, cancellationToken).ConfigureAwait(false))
 				{
 					await chat.SendUpdateMessage(String.Format(CultureInfo.InvariantCulture, "Deploying revision: {0}{1}{2} BYOND Version: {3}", commitInsert, testmergeInsert, remoteCommitInsert, byondLock.Version), cancellationToken).ConfigureAwait(false);
-
-					await ioManager.CreateDirectory(job.DirectoryName.ToString(), cancellationToken).ConfigureAwait(false);
-					var dirA = ioManager.ConcatPath(job.DirectoryName.ToString(), ADirectoryName);
-					var dirB = ioManager.ConcatPath(job.DirectoryName.ToString(), BDirectoryName);
+					announced = true;

 					async Task CleanupFailedCompile(bool cancelled)
 					{
 						logger.LogTrace("Cleaning compile directory...");
 						Status = CompilerStatus.Cleanup;
-						var chatTask = chat.SendUpdateMessage(cancelled ? "Deploy cancelled!" : "Deploy failed!", cancellationToken);
+						var chatTask = announced ? chat.SendUpdateMessage(cancelled ? "Deploy cancelled!" : "Deploy failed!", cancellationToken) : Task.CompletedTask;
 						try
 						{
 							await ioManager.DeleteDirectory(job.DirectoryName.ToString(), CancellationToken.None).ConfigureAwait(false);
@@ -315,6 +313,11 @@

 					try
 					{
+						await ioManager.CreateDirectory(job.DirectoryName.ToString(), cancellationToken).ConfigureAwait(false);
+
+						var dirA = ioManager.ConcatPath(job.DirectoryName.ToString(), ADirectoryName);
+						var dirB = ioManager.ConcatPath(job.DirectoryName.ToString(), BDirectoryName);
+
 						logger.LogTrace("Copying repository to game directory...");
 						//copy the repository
 						var fullDirA = ioManager.ResolvePath(dirA);


Translate document type description (#12409)

--- src/Umbraco.Web.BackOffice/Controllers/ContentController.cs
+++ src/Umbraco.Web.BackOffice/Controllers/ContentController.cs
@@ -438,8 +438,10 @@
             display.ContentTypeName = _localizedTextService.UmbracoDictionaryTranslate(CultureDictionary, display.ContentTypeName);
             // if your user type doesn't have access to the Settings section it would not get this property mapped
             if (display.DocumentType != null)
+            {
                 display.DocumentType.Name = _localizedTextService.UmbracoDictionaryTranslate(CultureDictionary, display.DocumentType.Name);
-
+                display.DocumentType.Description = _localizedTextService.UmbracoDictionaryTranslate(CultureDictionary, display.DocumentType.Description);
+            }
             //remove the listview app if it exists
             display.ContentApps = display.ContentApps.Where(x => x.Alias != "umbListView").ToList();


Better diagnostics when using NMF debug build

--- Models/Models/Changes/ApplyChanges.cs
+++ Models/Models/Changes/ApplyChanges.cs
@@ -2,6 +2,7 @@
 using NMF.Models.Repository;
 using System;
 using System.Collections.Generic;
+using System.Diagnostics;
 using System.Linq;
 using System.Text;
 using System.Threading.Tasks;
@@ -84,6 +85,12 @@

         public override void Apply()
         {
+#if DEBUG
+            if (AffectedElement.GetReferencedElement((IReference)Feature, Index) != DeletedElement)
+            {
+                Debugger.Break();
+            }
+#endif
             AffectedElement.GetReferencedElements((IReference)Feature).RemoveAt(Index);
         }
     }
@@ -135,6 +142,12 @@

         public override void Apply()
         {
+#if DEBUG
+            if (AffectedElement.GetReferencedElement((IReference)Feature, Index) != DeletedElement)
+            {
+                Debugger.Break();
+            }
+#endif
             AffectedElement.GetReferencedElements((IReference)Feature).RemoveAt(Index);
         }
     }


Renamed AnyInt parameters to lengthStart and lengthEnd

--- Nancy.RouteHelpers/RouteParameters.cs
+++ Nancy.RouteHelpers/RouteParameters.cs
@@ -8,9 +8,9 @@
 			return @"/(?<id>[\d]+)";
 		}

-		public static string AnyInt(int val1, int val2)
+		public static string AnyInt(int lengthStart, int lengthEnd)
 		{
-			return @"/(?<id>[\d]{" + val1 + "," + val2 + "})";
+			return @"/(?<id>[\d]{" + lengthStart + "," + lengthEnd + "})";
 		}

 		//string, string length, certain string, certain number


Refactor: new C# features used

Refactor: new C# features used

--- src/reni2/Code/RecursiveCallCandidate.cs
+++ src/reni2/Code/RecursiveCallCandidate.cs
@@ -12,9 +12,7 @@
     /// </summary>
     sealed class RecursiveCallCandidate : FiberItem
     {
-        readonly Size _refsSize;
-
-        internal override Size InputSize => _refsSize;
+        internal override Size InputSize { get; }

         internal override Size OutputSize => Size.Zero;

@@ -28,6 +26,6 @@
             return base.TryToCombineBack(precedingElement);
         }

-        internal RecursiveCallCandidate(Size refsSize) { _refsSize = refsSize; }
+        internal RecursiveCallCandidate(Size refsSize) { InputSize = refsSize; }
     }
 }


Moved from "en-US" to "en" for the default resource language

--- etc/AssemblyInfo.Common.cs
+++ etc/AssemblyInfo.Common.cs
@@ -17,7 +17,7 @@
 [assembly: AssemblyTrademark("")]
 [assembly: AssemblyCulture("")]

-[assembly: NeutralResourcesLanguage("en-US")]
+[assembly: NeutralResourcesLanguage("en")]

 [assembly: CLSCompliant(true)]
 [assembly: ComVisible(false)]


removed an error regarding Multiarrays

removed an error regarding Multiarrays

--- src/Generator.cs
+++ src/Generator.cs
@@ -331,14 +331,14 @@
 					break;

 				case "rosidl_generator_c__primitive_array_bool":
-					WrapperClassString.AppendLine ("        public bool[] "+ item.name);
+					WrapperClassString.AppendLine ("        public System.Boolean[] "+ item.name);
 					WrapperClassString.AppendLine ("        {");
 					WrapperClassString.AppendLine ("            get{return __data."+item.name+".Array;}");
 					WrapperClassString.AppendLine ("            set{__data."+item.name+".Free(); __data."+item.name+" = new rosidl_generator_c__primitive_array_bool(value);}");

 					break;
 				case "rosidl_generator_c__primitive_array_float32":
-					WrapperClassString.AppendLine ("        public float[] "+ item.name);
+					WrapperClassString.AppendLine ("        public System.Single[] "+ item.name);
 					WrapperClassString.AppendLine ("        {");
 					WrapperClassString.AppendLine ("            get{return __data."+item.name+".Array;}");
 					WrapperClassString.AppendLine ("            set{__data."+item.name+".Free(); __data."+item.name+" = new rosidl_generator_c__primitive_array_float32(value);}");
@@ -346,35 +346,35 @@
 					break;

 				case "rosidl_generator_c__primitive_array_float64":
-					WrapperClassString.AppendLine ("        public double[] "+ item.name);
+					WrapperClassString.AppendLine ("        public System.Double[] "+ item.name);
 					WrapperClassString.AppendLine ("        {");
 					WrapperClassString.AppendLine ("            get{return __data."+item.name+".Array;}");
 					WrapperClassString.AppendLine ("            set{__data."+item.name+".Free(); __data."+item.name+" = new rosidl_generator_c__primitive_array_float64(value);}");

 					break;
 				case "rosidl_generator_c__primitive_array_int8":
-					WrapperClassString.AppendLine ("        public Byte[] "+ item.name);
+					WrapperClassString.AppendLine ("        public System.Byte[] "+ item.name);
 					WrapperClassString.AppendLine ("        {");
 					WrapperClassString.AppendLine ("            get{return __data."+item.name+".Array;}");
 					WrapperClassString.AppendLine ("            set{__data."+item.name+".Free(); __data."+item.name+" = new rosidl_generator_c__primitive_array_int8(value);}");

 					break;
 				case "rosidl_generator_c__primitive_array_uint8":
-					WrapperClassString.AppendLine ("        public SByte[] "+ item.name);
+					WrapperClassString.AppendLine ("        public System.SByte[] "+ item.name);
 					WrapperClassString.AppendLine ("        {");
 					WrapperClassString.AppendLine ("            get{return __data."+item.name+".Array;}");
 					WrapperClassString.AppendLine ("            set{__data."+item.name+".Free(); __data."+item.name+" = new rosidl_generator_c__primitive_array_uint8(value);}");

 					break;
 				case "rosidl_generator_c__primitive_array_int16":
-					WrapperClassString.AppendLine ("        public Int16[] "+ item.name);
+					WrapperClassString.AppendLine ("        public System.Int16[] "+ item.name);
 					WrapperClassString.AppendLine ("        {");
 					WrapperClassString.AppendLine ("            get{return __data."+item.name+".Array;}");
 					WrapperClassString.AppendLine ("            set{__data."+item.name+".Free(); __data."+item.name+" = new rosidl_generator_c__primitive_array_int16(value);}");

 					break;
 				case "rosidl_generator_c__primitive_array_uint16":
-					WrapperClassString.AppendLine ("        public UInt16[] "+ item.name);
+					WrapperClassString.AppendLine ("        public System.UInt16[] "+ item.name);
 					WrapperClassString.AppendLine ("        {");
 					WrapperClassString.AppendLine ("            get{return __data."+item.name+".Array;}");
 					WrapperClassString.AppendLine ("            set{__data."+item.name+".Free(); __data."+item.name+" = new rosidl_generator_c__primitive_array_uint16(value);}");
@@ -383,14 +383,14 @@

 				case "rosidl_generator_c__primitive_array_int32":
-					WrapperClassString.AppendLine ("        public Int32[] "+ item.name);
+					WrapperClassString.AppendLine ("        public System.Int32[] "+ item.name);
 					WrapperClassString.AppendLine ("        {");
 					WrapperClassString.AppendLine ("            get{return __data."+item.name+".Array;}");
 					WrapperClassString.AppendLine ("            set{__data."+item.name+".Free(); __data."+item.name+" = new rosidl_generator_c__primitive_array_int32(value);}");

 					break;
 				case "rosidl_generator_c__primitive_array_uint32":
-					WrapperClassString.AppendLine ("        public UInt32[] "+ item.name);
+					WrapperClassString.AppendLine ("        public System.UInt32[] "+ item.name);
 					WrapperClassString.AppendLine ("        {");
 					WrapperClassString.AppendLine ("            get{return __data."+item.name+".Array;}");
 					WrapperClassString.AppendLine ("            set{__data."+item.name+".Free(); __data."+item.name+" = new rosidl_generator_c__primitive_array_uint32(value);}");
@@ -399,14 +399,14 @@

 				case "rosidl_generator_c__primitive_array_int64":
-					WrapperClassString.AppendLine ("        public Int64[] "+ item.name);
+					WrapperClassString.AppendLine ("        public System.Int64[] "+ item.name);
 					WrapperClassString.AppendLine ("        {");
 					WrapperClassString.AppendLine ("            get{return __data."+item.name+".Array;}");
 					WrapperClassString.AppendLine ("            set{__data."+item.name+".Free(); __data."+item.name+" = new rosidl_generator_c__primitive_array_int64(value);}");

 					break;
 				case "rosidl_generator_c__primitive_array_uint64":
-					WrapperClassString.AppendLine ("        public UInt64[] "+ item.name);
+					WrapperClassString.AppendLine ("        public System.UInt64[] "+ item.name);
 					WrapperClassString.AppendLine ("        {");
 					WrapperClassString.AppendLine ("            get{return __data."+item.name+".Array;}");
 					WrapperClassString.AppendLine ("            set{__data."+item.name+".Free(); __data."+item.name+" = new rosidl_generator_c__primitive_array_uint64(value);}");
@@ -426,8 +426,10 @@
 						WrapperClassString.AppendLine ("            set{__data." + item.name + " = value;}");
 					} else {
 						WrapperClassString.AppendLine ("            get{return __"+item.name+"; }");
-						WrapperClassSyncExtensions.AppendLine ("          __data." + item.name + "=__" + item.name + ".Data;");
-						WrapperClassInSyncExtensions.AppendLine ("            __" + item.name + " =new " + item.type + "(" +" ref __data."+item.name+ ");");
+						WrapperClassSyncExtensions.AppendLine ("           __data." + item.name + "=__" + item.name + ".Data;");
+						WrapperClassSyncExtensions.AppendLine ("           __"+item.name+ ".SyncDataOut();");
+						WrapperClassInSyncExtensions.AppendLine ("           __" + item.name + " =new " + item.type + "(" +" ref __data."+item.name+ ");");
+						WrapperClassInSyncExtensions.AppendLine ("           __"+item.name+ ".SyncDataIn();");
 						//WrapperClassString.AppendLine ("            set{}");
 					}
 					break;
@@ -439,21 +441,21 @@
 			ClassString.AppendLine ("}");

-			WrapperClassString.AppendLine ("        public "+ Name + "()");
-			WrapperClassString.AppendLine ("        {");
-
-			WrapperClassString.AppendLine ("           " +WrapperClassConstructorExtensions.ToString());
-
-			WrapperClassString.AppendLine ("        }");
-			WrapperClassString.AppendLine ("");
-			WrapperClassString.AppendLine ("        public override void SyncDataOut()");
-			WrapperClassString.AppendLine ("        {");
-			WrapperClassString.AppendLine ("           " + WrapperClassSyncExtensions.ToString ());
-			WrapperClassString.AppendLine ("        }");
-			WrapperClassString.AppendLine ("        public override void SyncDataIn()");
-			WrapperClassString.AppendLine ("        {");
-			WrapperClassString.AppendLine ("           " + WrapperClassInSyncExtensions.ToString ());
-			WrapperClassString.AppendLine ("        }");
+			WrapperClassString.AppendLine ("          public "+ Name + "()");
+			WrapperClassString.AppendLine ("          {");
+
+			WrapperClassString.AppendLine ("" +WrapperClassConstructorExtensions.ToString());
+
+			WrapperClassString.AppendLine ("          }");
+			WrapperClassString.AppendLine ("");
+			WrapperClassString.AppendLine ("          public override void SyncDataOut()");
+			WrapperClassString.AppendLine ("          {");
+			WrapperClassString.AppendLine ("" + WrapperClassSyncExtensions.ToString ());
+			WrapperClassString.AppendLine ("          }");
+			WrapperClassString.AppendLine ("          public override void SyncDataIn()");
+			WrapperClassString.AppendLine ("          {");
+			WrapperClassString.AppendLine ("" + WrapperClassInSyncExtensions.ToString ());
+			WrapperClassString.AppendLine ("          }");
 			WrapperClassString.AppendLine ("        }");
 			WrapperClassString.AppendLine ("    }");
 			WrapperClassString.AppendLine ("}");


Fix bug where null is serialized as "null"

--- NiL.JS/Core/Interop/JsonSerializer.cs
+++ NiL.JS/Core/Interop/JsonSerializer.cs
@@ -155,7 +155,7 @@
         {
             if (value == null)
             {
-                result.Append("\"").Append(value ?? "null").Append("\"");
+                result.Append("null");
                 return;
             }

@@ -223,4 +223,4 @@
             return null;
         }
     }
-}+}


Small changes

Small changes

--- NuGetFeed/Views/Shared/_Layout.cshtml
+++ NuGetFeed/Views/Shared/_Layout.cshtml
@@ -75,7 +75,8 @@
         @RenderBody()

-
Powered by AppHarbor

+
Powered by AppHarbor

+
thomasardal.com | hippovalidator.com


Add block store task to async provider (#3670)

--- src/Stratis.Bitcoin.Features.BlockStore/BlockStoreQueue.cs
+++ src/Stratis.Bitcoin.Features.BlockStore/BlockStoreQueue.cs
@@ -186,6 +186,8 @@
             // Start dequeuing.
             this.currentBatchSizeBytes = 0;
             this.dequeueLoopTask = this.DequeueBlocksContinuouslyAsync();
+
+            this.asyncProvider.RegisterTask($"{nameof(BlockStoreQueue)}.{nameof(this.dequeueLoopTask)}", this.dequeueLoopTask);
         }

         /// <inheritdoc/>


Node settings not used, so removed (#1722)

--- src/Stratis.Bitcoin.Features.Consensus/ConsensusFeature.cs
+++ src/Stratis.Bitcoin.Features.Consensus/ConsensusFeature.cs
@@ -50,8 +50,6 @@

         private readonly IRuleRegistration ruleRegistration;

-        private readonly NodeSettings nodeSettings;
-
         private readonly ConsensusSettings consensusSettings;

         private readonly IConsensusRules consensusRules;
@@ -96,7 +94,6 @@
             this.loggerFactory = loggerFactory;
             this.consensusStats = consensusStats;
             this.ruleRegistration = ruleRegistration;
-            this.nodeSettings = nodeSettings;
             this.consensusSettings = consensusSettings;
             this.consensusRules = consensusRules;


Cleaned up VTimeZone a bit, added X-LIC-LOCATION

--- v2/ical.NET/Components/VTimeZone.cs
+++ v2/ical.NET/Components/VTimeZone.cs
@@ -1,24 +1,20 @@
 using System;
 using System.Collections.Generic;
-using System.ComponentModel;
 using System.Linq;
-using System.Reflection.Emit;
 using Ical.Net.DataTypes;
 using Ical.Net.ExtensionMethods;
 using Ical.Net.Interfaces.Components;
 using Ical.Net.Interfaces.DataTypes;
-using Ical.Net.Interfaces.General;
 using Ical.Net.Utility;
 using NodaTime;
 using NodaTime.TimeZones;
-using Period = NodaTime.Period;

 namespace Ical.Net
 {
     /// <summary>
     /// Represents an RFC 5545 VTIMEZONE component.
     /// </summary>
-    public class VTimeZone : CalendarComponent, ITimeZone
+    public sealed class VTimeZone : CalendarComponent, ITimeZone
     {
         public static VTimeZone FromLocalTimeZone()
         {
@@ -156,8 +152,7 @@
             var delta = new TimeSpan(1,0,0);
             if (previousInterval != null)
             {
-                delta = (intervals.SingleOrDefault(x => x.End == oldestInterval.Start).WallOffset -
-                         oldestInterval.WallOffset).ToTimeSpan();
+                delta = (previousInterval.WallOffset - oldestInterval.WallOffset).ToTimeSpan();
             }
             else if(isOnlyInterval)
             {
@@ -186,11 +181,7 @@
             timeZoneInfo.TimeZoneName = oldestInterval.Name;

             var start = oldestInterval.IsoLocalStart.ToDateTimeUnspecified() + delta;
-            timeZoneInfo.Start = new CalDateTime(start);
-            timeZoneInfo.Start.HasTime = true;
-
-            //if (start < earliest.InZone(zone).ToDateTimeUnspecified())
-              //  timeZoneInfo.Start = timeZoneInfo.Start.AddYears(earliest.InZone(zone).Year - timeZoneInfo.Start.Year);
+            timeZoneInfo.Start = new CalDateTime(start) {HasTime = true};

             if(isRRule)
                 PopulateTimeZoneInfoRecurrenceRules(timeZoneInfo, oldestInterval);
@@ -258,9 +249,12 @@
                 var periodList = new PeriodList();
                 var time = interval.IsoLocalStart.ToDateTimeUnspecified();
                 var date = new CalDateTime(time).Add(delta) as CalDateTime;
-                date.HasTime = true;
-                periodList.Add(date); // BUG:  Prints
-                tzi.RecurrenceDates.Add(periodList);
+                if (date != null)
+                {
+                    date.HasTime = true;
+                    periodList.Add(date);
+                    tzi.RecurrenceDates.Add(periodList);
+                }
             }
         }

@@ -295,10 +289,11 @@
             }

             TzId = tzId;
+            Location = tzId;
         }

         private string _tzId;
-        public virtual string TzId
+        public string TzId
         {
             get
             {
@@ -320,9 +315,9 @@

         private Uri _url;

-        public virtual Uri Url
-        {
-            get { return _url ?? (_url = Properties.Get<Uri>("TZURL")); }
+        public Uri Url
+        {
+            get => _url ?? (_url = Properties.Get<Uri>("TZURL"));
             set
             {
                 _url = value;
@@ -330,9 +325,20 @@
             }
         }

+        private string _location;
+        public string Location
+        {
+            get => _location ?? (_location = Properties.Get<string>("X-LIC-LOCATION"));
+            set
+            {
+                _location = value;
+                Properties.Set("X-LIC-LOCATION", _location);
+            }
+        }
+
         public HashSet<ITimeZoneInfo> TimeZoneInfos { get; set; }

-        protected bool Equals(VTimeZone other)
+        private bool Equals(VTimeZone other)
         {
             return string.Equals(Name, other.Name, StringComparison.OrdinalIgnoreCase)
                 && string.Equals(TzId, other.TzId, StringComparison.OrdinalIgnoreCase)
@@ -343,8 +349,7 @@
         {
             if (ReferenceEquals(null, obj)) return false;
             if (ReferenceEquals(this, obj)) return true;
-            if (obj.GetType() != this.GetType()) return false;
-            return Equals((VTimeZone)obj);
+            return obj.GetType() == GetType() && Equals((VTimeZone)obj);
         }

         public override int GetHashCode()


Cleanup CallInfo tests and increase coverage of ListEquals (#15784)

* Cleanup CallInfo tests and increase coverage of ListEquals

--- src/System.Linq.Expressions/tests/Dynamic/CallInfoTests.cs
+++ src/System.Linq.Expressions/tests/Dynamic/CallInfoTests.cs
@@ -12,112 +12,77 @@
     public class CallInfoTests
     {
         [Fact]
-        public void NullNames()
+        public void Ctor_NullNames_ThrowsArgumentNullException()
         {
             Assert.Throws<ArgumentNullException>("argNames", () => new CallInfo(0, default(IEnumerable<string>)));
             Assert.Throws<ArgumentNullException>("argNames", () => new CallInfo(0, default(string[])));
         }

-        [Fact]
-        public void NegativeCount()
+        [Theory]
+        [InlineData(-1, new string[0])]
+        [InlineData(2, new string[] { "foo", "bar", "baz", "quux", "quuux" })]
+        public void Ctor_CountLessThanArgNamesCount_ThrowsArgumentException(int argCount, string[] argNames)
         {
-            Assert.Throws<ArgumentException>(null, () => new CallInfo(-1));
+            Assert.Throws<ArgumentException>(null, () => new CallInfo(argCount, argNames));
         }

         [Fact]
-        public void CountLessThanNameCount()
-        {
-            Assert.Throws<ArgumentException>(null, () => new CallInfo(2, "foo", "bar", "baz", "quux", "quuux"));
-        }
-
-        [Fact]
-        public void NullItem()
+        public void Ctor_NullItemInArgNames_ThrowsArgumentNullException()
         {
             Assert.Throws<ArgumentNullException>("argNames[1]", () => new CallInfo(3, "foo", null, "bar"));
             Assert.Throws<ArgumentNullException>(
                 "argNames[0]", () => new CallInfo(3, Enumerable.Repeat(default(string), 2)));
         }

-        [Fact]
-        public void ArgumentCountMatches()
+        [Theory]
+        [InlineData(0, new string[0])]
+        [InlineData(1, new string[0])]
+        [InlineData(5, new string[] { "foo", "bar", "baz", "quux", "quuux" })]
+        public void Ctor_Int_String(int argCount, string[] argNames)
         {
-            for (int i = 0; i != 10; ++i)
+            var info1 = new CallInfo(argCount, argNames);
+            Assert.Equal(argCount, info1.ArgumentCount);
+            Assert.Equal(argNames, info1.ArgumentNames);
+
+            var info2 = new CallInfo(argCount, (IEnumerable<string>)argNames);
+            Assert.Equal(argCount, info2.ArgumentCount);
+            Assert.Equal(argNames, info2.ArgumentNames);
+        }
+
+        public static IEnumerable<object[]> Equals_TestData()
+        {
+            CallInfo basicCallInfo = new CallInfo(1, new string[0]);
+            yield return new object[] { basicCallInfo, new CallInfo(1, new string[0]), true };
+            yield return new object[] { basicCallInfo, basicCallInfo, true };
+            yield return new object[] { basicCallInfo, new CallInfo(0, new string[0]), false };
+            yield return new object[] { basicCallInfo, new CallInfo(1, new string[] { "foo" }), false };
+
+            yield return new object[] { new CallInfo(2, new string[] { "foo", "bar" }), new CallInfo(2, new string[] { "foo", "bar" }), true};
+            yield return new object[] { new CallInfo(2, new string[] { "foo", "bar" }), new CallInfo(2, new string[] { "foo", "baz" }), false };
+            yield return new object[] { new CallInfo(2, new string[] { "foo", "bar" }), new CallInfo(3, new string[] { "foo", "bar" }), false };
+
+            yield return new object[] { basicCallInfo, "CallInfo", false };
+            yield return new object[] { basicCallInfo, new object(), false };
+            yield return new object[] { basicCallInfo, null, false };
+        }
+
+        [Theory]
+        [MemberData(nameof(Equals_TestData))]
+        public static void Equals_GetHashCode_ReturnsExpected(CallInfo info, object obj, bool expected)
+        {
+            Assert.Equal(expected, info.Equals(obj));
+
+            if (obj is CallInfo)
             {
-                var info = new CallInfo(i);
-                Assert.Equal(i, info.ArgumentCount);
+                // Failure at this point is not definitely a bug,
+                // but should be considered a concern unless it can be
+                // convincingly ruled a fluke.
+                Assert.Equal(expected, info.GetHashCode().Equals(obj.GetHashCode()));
             }
         }

         [Fact]
-        public void ArgumentNamesMatch()
-        {
-            var info = new CallInfo(5, "foo", "bar", "baz", "quux", "quuux");
-            Assert.Equal(new[] {"foo", "bar", "baz", "quux", "quuux"}, info.ArgumentNames);
-        }
-
-        [Fact]
-        public void EqualityBasedOnNamesAndCount()
-        {
-            string[] names = new[] {"foo", "bar", "baz", "quux", "quuux"};
-            for (int i = 0; i <= names.Length; ++i)
-            {
-                for (int j = 0; j != 3; ++j)
-                {
-                    for (int x = 0; x <= names.Length; ++x)
-                    {
-                        for (int y = 0; y != 3; ++y)
-                        {
-                            var info0 = new CallInfo(i + j, names.Take(i));
-                            var info1 = new CallInfo(x + y, names.Take(x));
-                            Assert.Equal(i == x & j == y, info0.Equals(info1));
-                        }
-                    }
-                }
-            }
-        }
-
-        [Fact]
-        public void HashCodeBasedOnEquality()
-        {
-            string[] names = new[] {"foo", "bar", "baz", "quux", "quuux"};
-            for (int i = 0; i <= names.Length; ++i)
-            {
-                for (int j = 0; j != 3; ++j)
-                {
-                    for (int x = 0; x <= names.Length; ++x)
-                    {
-                        for (int y = 0; y != 3; ++y)
-                        {
-                            var info0 = new CallInfo(i + j, names.Take(i));
-                            var info1 = new CallInfo(x + y, names.Take(x));
-                            if (info0.Equals(info1))
-                            {
-                                Assert.Equal(info0.GetHashCode(), info1.GetHashCode());
-                            }
-                            else
-                            {
-                                // Failure at this point is not definitely a bug,
-                                // but should be considered a concern unless it can be
-                                // convincingly ruled a fluke.
-                                Assert.NotEqual(info0.GetHashCode(), info1.GetHashCode());
-                            }
-                        }
-                    }
-                }
-            }
-        }
-
-        [Fact]
-        public void NotEqualToNonCallInfo()
-        {
-            var info = new CallInfo(0);
-            Assert.False(info.Equals(null));
-            Assert.False(info.Equals("CallInfo"));
-            Assert.False(info.Equals(23));
-        }
-
-        [Fact]
-        public void FreshCopyOfNamesMadeEnumerable()
+        public void Ctor_Enumerable_MakesReadOnlyCopy()
         {
             List<string> nameList = new List<string> {"foo", "bar"};
             ReadOnlyCollection<string> nameReadOnly = nameList.AsReadOnly();
@@ -128,7 +93,7 @@
         }

         [Fact]
-        public void FreshCopyOfNamesMadeArray()
+        public void Ctor_Array_MakesReadOnlyCopy()
         {
             string[] nameArray = {"foo", "bar"};
             var nameReadOnly = new ReadOnlyCollection<string>(nameArray);


And ref assembly

And ref assembly

--- src/System.Runtime.Numerics/ref/System.Runtime.Numerics.cs
+++ src/System.Runtime.Numerics/ref/System.Runtime.Numerics.cs
@@ -34,6 +34,7 @@
         public static System.Numerics.BigInteger Add(System.Numerics.BigInteger left, System.Numerics.BigInteger right) { return default(System.Numerics.BigInteger); }
         public static int Compare(System.Numerics.BigInteger left, System.Numerics.BigInteger right) { return default(int); }
         public int CompareTo(long other) { return default(int); }
+        public int CompareTo(object obj) { return default(int); }
         public int CompareTo(System.Numerics.BigInteger other) { return default(int); }
         [System.CLSCompliantAttribute(false)]
         public int CompareTo(ulong other) { return default(int); }
@@ -148,7 +149,6 @@
         public static System.Numerics.BigInteger Pow(System.Numerics.BigInteger value, int exponent) { return default(System.Numerics.BigInteger); }
         public static System.Numerics.BigInteger Remainder(System.Numerics.BigInteger dividend, System.Numerics.BigInteger divisor) { return default(System.Numerics.BigInteger); }
         public static System.Numerics.BigInteger Subtract(System.Numerics.BigInteger left, System.Numerics.BigInteger right) { return default(System.Numerics.BigInteger); }
-        int System.IComparable.CompareTo(object obj) { return default(int); }
         public byte[] ToByteArray() { return default(byte[]); }
         public override string ToString() { return default(string); }
         public string ToString(System.IFormatProvider provider) { return default(string); }


change.

change.

--- src/TWCore.Serialization.NSerializer/DeserializersTable.cs
+++ src/TWCore.Serialization.NSerializer/DeserializersTable.cs
@@ -20,6 +20,7 @@
 using System.Reflection;
 using System.Runtime.CompilerServices;
 using System.Text;
+using NonBlocking;
 using TWCore.Reflection;

 namespace TWCore.Serialization.NSerializer
@@ -27,6 +28,7 @@
     public partial class DeserializersTable
     {
         internal static readonly Dictionary<byte, (MethodInfo Method, MethodAccessorDelegate Accessor)> ReadValues = new Dictionary<byte, (MethodInfo Method, MethodAccessorDelegate Accessor)>();
+        internal static readonly ConcurrentDictionary<Type, DeserializerTypeDescriptor> Descriptors = new ConcurrentDictionary<Type, DeserializerTypeDescriptor>();
         private static readonly byte[] EmptyBytes = new byte[0];
         private readonly byte[] _buffer = new byte[16];
         private readonly object[] _parameters = new object[1];
@@ -45,6 +47,7 @@
         private readonly DeserializerStringCache _stringCache32 = new DeserializerStringCache();
         private readonly DeserializerStringCache _stringCache = new DeserializerStringCache();
         private readonly DeserializerCache<TimeSpan> _timespanCache = new DeserializerCache<TimeSpan>();
+        private readonly Dictionary<Type, string[]> _propertiesByType = new Dictionary<Type, string[]>();
         protected Stream Stream;

         #region Attributes
@@ -66,7 +69,7 @@
             {
                 var attr = method.GetAttribute<DeserializerMethodAttribute>();
                 if (attr == null) continue;
-                foreach(var byteType in attr.ByteTypes)
+                foreach (var byteType in attr.ByteTypes)
                     ReadValues[byteType] = (method, Factory.Accessors.BuildMethodAccessor(method));
             }
         }
@@ -81,6 +84,8 @@

             ReadValue(ReadByte());
             while (ReadByte() != DataBytesDefinition.End)
+            {
+            }

             _dateTimeOffsetCache.Clear();
             _dateTimeCache.Clear();
@@ -95,6 +100,7 @@
             _stringCache32.Clear();
             _stringCache.Clear();
             _timespanCache.Clear();
+            _propertiesByType.Clear();
             Stream = null;
             return null;
         }
@@ -110,13 +116,26 @@
                 _parameters[0] = type;
                 return mTuple.Accessor(this, _parameters);
             }
+            Type valueType = null;
+            string[] properties = null;
+
             if (type == DataBytesDefinition.TypeStart)
             {
                 var length = ReadInt();
                 var typeBytes = new byte[length];
                 Stream.Read(typeBytes, 0, length);
-                var typeData = Encoding.UTF8.GetString(typeBytes, 0, length).Split(';');
+                var typeData = Encoding.UTF8.GetString(typeBytes, 0, length);
+                valueType = Core.GetType(typeData.Substring(0, typeData.IndexOf(";", StringComparison.Ordinal)));
+                properties = typeData.Substring(typeData.IndexOf(";", StringComparison.Ordinal) + 1).Split(';');
+                _propertiesByType[valueType] = properties;
             }
+            else if (type == DataBytesDefinition.RefType)
+            {
+                valueType = _typeCache.Get(ReadInt());
+                properties = _propertiesByType[valueType];
+            }
+            var descriptor = Descriptors.GetOrAdd(valueType, vType => new DeserializerTypeDescriptor(vType));
+
             return null;
         }

@@ -682,4 +701,16 @@
         }
         #endregion
     }
+
+    public struct DeserializerTypeDescriptor
+    {
+        public Type Type;
+        public ActivatorDelegate Activator;
+
+        public DeserializerTypeDescriptor(Type type)
+        {
+            Type = type;
+            Activator = Factory.Accessors.CreateActivator(type);
+        }
+    }
 }


changes

changes

--- src/TWCore.Serialization.NSerializer/DeserializersTable.cs
+++ src/TWCore.Serialization.NSerializer/DeserializersTable.cs
@@ -33,8 +33,8 @@
     {
         internal static readonly Dictionary<byte, (MethodInfo Method, MethodAccessorDelegate Accessor)> ReadValues = new Dictionary<byte, (MethodInfo Method, MethodAccessorDelegate Accessor)>();
         internal static readonly ConcurrentDictionary<Type, DeserializerTypeDescriptor> Descriptors = new ConcurrentDictionary<Type, DeserializerTypeDescriptor>();
-        private static readonly MethodInfo StreamReadByteMethod = typeof(DeserializersTable).GetMethod("StreamReadByte", BindingFlags.NonPublic | BindingFlags.Instance);
-        private static readonly MethodInfo StreamReadIntMethod = typeof(DeserializersTable).GetMethod("StreamReadInt", BindingFlags.NonPublic | BindingFlags.Instance);
+        internal static readonly MethodInfo StreamReadByteMethod = typeof(DeserializersTable).GetMethod("StreamReadByte", BindingFlags.NonPublic | BindingFlags.Instance);
+        internal static readonly MethodInfo StreamReadIntMethod = typeof(DeserializersTable).GetMethod("StreamReadInt", BindingFlags.NonPublic | BindingFlags.Instance);
         private static readonly byte[] EmptyBytes = new byte[0];
         private readonly byte[] _buffer = new byte[16];
         private readonly object[] _parameters = new object[1];
@@ -835,7 +835,20 @@
             var table = Expression.Parameter(typeof(DeserializersTable), "table");
             var descriptor = Expression.Parameter(typeof(DeserializerTypeDescriptor), "descriptor");
             var properties = Expression.Parameter(typeof(string[]), "properties");
+
+            var value = Expression.Parameter(typeof(object), "value");
             var flag = Expression.Parameter(typeof(byte), "flag");
+            varExpressions.Add(value);
+            varExpressions.Add(flag);
+
+            serExpressions.Add(Expression.Assign(flag, Expression.Call(table, DeserializersTable.StreamReadByteMethod)));
+
+            var arrayOrListIf = Expression.Or(
+                Expression.Equal(flag, Expression.Constant(DataBytesDefinition.ArrayStart, typeof(byte))),
+                Expression.Equal(flag, Expression.Constant(DataBytesDefinition.ListStart, typeof(byte))));
+            var dictionaryIf = Expression.Equal(flag, Expression.Constant(DataBytesDefinition.DictionaryStart, typeof(byte)));
+
+            var comparerExpression = Expression.Or(arrayOrListIf, dictionaryIf);

         }


Fixing a bug in 'Sequence`8'

Fixing a bug in 'Sequence`8'

--- src/Text.Scanning/src/Sequence{T1,T2,T3,T4,T5,T6,T7,T8}.cs
+++ src/Text.Scanning/src/Sequence{T1,T2,T3,T4,T5,T6,T7,T8}.cs
@@ -90,7 +90,8 @@
                     element4.Data,
                     element5.Data,
                     element6.Data,
-                    element7.Data),
+                    element7.Data,
+                    element8.Data),
                 context)
         {
             Contract.Requires(element1 != null);


Add ParseDecimal method

Add ParseDecimal method

--- src/Umbraco.Web.Common/ImageProcessors/CropWebProcessor.cs
+++ src/Umbraco.Web.Common/ImageProcessors/CropWebProcessor.cs
@@ -42,7 +42,6 @@

         private static Rectangle GetCropRectangle(int width, int height, ImageCropperCropCoordinates coordinates)
         {
-
             // Get coordinates of top left corner of the rectangle
             var topX = decimal.ToInt32(width * coordinates.X1);
             var topY = decimal.ToInt32(height * coordinates.Y1);
@@ -68,11 +67,13 @@

             return new ImageCropperCropCoordinates()
             {
-                X1 = decimal.Parse(crops[0], CultureInfo.InvariantCulture),
-                Y1 = decimal.Parse(crops[1], CultureInfo.InvariantCulture),
-                X2 = decimal.Parse(crops[2], CultureInfo.InvariantCulture),
-                Y2 = decimal.Parse(crops[3], CultureInfo.InvariantCulture)
+                X1 = ParseDecimal(crops[0]),
+                Y1 = ParseDecimal(crops[1]),
+                X2 = ParseDecimal(crops[2]),
+                Y2 = ParseDecimal(crops[3])
             };
         }
+
+        private static decimal ParseDecimal(string decimalString) => decimal.Parse(decimalString, CultureInfo.InvariantCulture);
     }
 }


Add null check when mapping history cleanup

--- src/Umbraco.Web/Models/Mapping/ContentTypeMapDefinition.cs
+++ src/Umbraco.Web/Models/Mapping/ContentTypeMapDefinition.cs
@@ -100,6 +100,13 @@

         private static void MapHistoryCleanup(DocumentTypeSave source, IContentType target)
         {
+            // If source history cleanup is null we don't have to map all properties
+            if (source.HistoryCleanup is null)
+            {
+                target.HistoryCleanup = null;
+                return;
+            }
+
             // We need to reset the dirty properties, because it is otherwise true, just because the json serializer has set properties
             target.HistoryCleanup.ResetDirtyProperties(false);
             if (target.HistoryCleanup.PreventCleanup != source.HistoryCleanup.PreventCleanup)


(maint) formatting

(maint) formatting

--- src/chocolatey/infrastructure.app/ApplicationParameters.cs
+++ src/chocolatey/infrastructure.app/ApplicationParameters.cs
@@ -6,7 +6,7 @@
     using filesystem;

     /// <summary>
-    /// Application constants and settings for the application
+    ///   Application constants and settings for the application
     /// </summary>
     public static class ApplicationParameters
     {
@@ -31,7 +31,7 @@
         public static class Tools
         {
             //public static readonly string WebPiCmdExe = _fileSystem.combine_paths(InstallLocation, "nuget.exe");
-            public static readonly string ShimGenExe = _fileSystem.combine_paths(InstallLocation,"tools", "shimgen.exe");
+            public static readonly string ShimGenExe = _fileSystem.combine_paths(InstallLocation, "tools", "shimgen.exe");
         }

         public static class OutputParser


Corrected case to get columns from Regions table from PostgreSQL http://opensimulator.org/mantis/view.php?id=6865

Signed-off-by: Michael Cerquoni <aa59f40be69e6ea786d2005fc02b31107eaf029c@gmail.com>

--- OpenSim/Data/PGSQL/PGSQLRegionData.cs
+++ OpenSim/Data/PGSQL/PGSQLRegionData.cs
@@ -206,7 +206,7 @@

                     DataTable schemaTable = result.GetSchemaTable();
                     foreach (DataRow row in schemaTable.Rows)
-                        m_ColumnNames.Add(row["ColumnName"].ToString());
+                        m_ColumnNames.Add(row["column_name"].ToString());
                 }

                 foreach (string s in m_ColumnNames)
@@ -376,7 +376,7 @@

         private List<RegionData> Get(int regionFlags, UUID scopeID)
         {
-            string sql = "SELECT * FROM " + m_Realm + " WHERE (flags & " + regionFlags.ToString() + ") <> 0";
+            string sql = "SELECT * FROM " + m_Realm + " WHERE (\"flags\" & " + regionFlags.ToString() + ") <> 0";
             if (scopeID != UUID.Zero)
                 sql += " AND \"ScopeID\" = :scopeID";


rename Windows Phone folders.

rename Windows Phone folders.

--- PackageExplorer/PackageViewer.xaml.cs
+++ PackageExplorer/PackageViewer.xaml.cs
@@ -38,11 +38,11 @@
                     }
                 },
                 {
-                    "Windows Phone Immersive",
+                    "Windows Phone (Windows Runtime)",
                     new [] { "(no version)", "wpa", "v8.1", "wpa81"}
                 },
                 {
-                    "Windows Phone Silverlight",
+                    "Windows Phone (Silverlight)",
                     new[] {"v7.0", "sl3-wp", "v7.1 (Mango)", "sl4-wp71", "v8.0", "wp8", "v8.1", "wp81"}
                 },
                 {


credential form change, nslookup parsing regex change

--- Plugins/HttpAuth/HttpAuth/Accessor.cs
+++ Plugins/HttpAuth/HttpAuth/Accessor.cs
@@ -60,7 +60,6 @@
         {
             List<string> txtRecords = new List<string>();
             string output;
-            string pattern = string.Format(@"{0}\s*text =\s*""([\w\-\=]*)""", hostname);

             var startInfo = new ProcessStartInfo("nslookup");
             startInfo.Arguments = string.Format("-type=TXT {0}", hostname);
@@ -73,7 +72,7 @@
                 output = cmd.StandardOutput.ReadToEnd();
             }

-            MatchCollection matches = Regex.Matches(output, pattern, RegexOptions.IgnoreCase);
+            MatchCollection matches = Regex.Matches(output, "\"([^\"]*)\"", RegexOptions.IgnoreCase);
             foreach (Match match in matches)
             {
                 if (match.Success)
@@ -88,7 +87,7 @@
         {
             var cli = new WebClient();
             cli.Headers[HttpRequestHeader.ContentType] = "application/json";
-            var data = "{\"uname\":\"" + uname + "\",\"pwd\":\"" + pwd + "\"}";
+            var data = "{\"username\":\"" + uname + "\",\"password\":\"" + pwd + "\"}";

             try
             {


Use a lifetime scope for resolution

Use a lifetime scope for resolution

This allows us to use SessionState objects

--- PoshGit2/PoshGit2/Cmdlets/DICmdlet.cs
+++ PoshGit2/PoshGit2/Cmdlets/DICmdlet.cs
@@ -1,15 +1,48 @@
 using Autofac;
+using System;
 using System.Management.Automation;

 namespace PoshGit2.Cmdlets
 {
-    public class DICmdlet : Cmdlet
+    public class DICmdlet : PSCmdlet, IDisposable
     {
+        private readonly ILifetimeScope _lifetimeScope;
+
+        public DICmdlet()
+        {
+            _lifetimeScope = PoshGit2Container.Instance.BeginLifetimeScope(builder =>
+           {
+               builder.Register<SessionState>(_ => SessionState).AsSelf();
+           });
+        }
+
         protected override void BeginProcessing()
         {
             base.BeginProcessing();

-            PoshGit2Container.Instance.InjectUnsetProperties(this);
+            // TODO: This needs to be here for now, otherwise SessionState is not defined yet.
+            // TODO: Is this called on each time something is piped through?
+            _lifetimeScope.InjectUnsetProperties(this);
+        }
+
+        private bool disposedValue = false; // To detect redundant calls
+
+        protected virtual void Dispose(bool disposing)
+        {
+            if (!disposedValue)
+            {
+                if (disposing)
+                {
+                    _lifetimeScope.Dispose();
+                }
+
+                disposedValue = true;
+            }
+        }
+
+        public void Dispose()
+        {
+            Dispose(true);
         }
     }
 }


add dummy test

add dummy test

--- src/stream-net-tests/IntegrationTests.cs
+++ src/stream-net-tests/IntegrationTests.cs
@@ -486,6 +486,10 @@
             response = await this._user1.GetFlatActivities(GetOptions.Default.WithLimit(2).WithFilter(FeedFilter.Where().IdLessThan(third.Id)));
             activities = response.Results;
             Assert.AreEqual(second.Id, activities.First().Id);
+
+            response = await this._user1.GetFlatActivities(GetOptions.Default.WithLimit(2).WithSession("dummy").WithFilter(FeedFilter.Where().IdLessThan(third.Id)));
+            activities = response.Results;
+            Assert.AreEqual(second.Id, activities.First().Id);
         }

         [Test]


Add RGBA_Bytes TypeConverter to support setting colors from Inspector

--- agg/agg_color_rgba.cs
+++ agg/agg_color_rgba.cs
@@ -25,6 +25,8 @@
 //          http://www.antigrain.com
 //----------------------------------------------------------------------------
 using System;
+using System.ComponentModel;
+using System.Globalization;
 using Newtonsoft.Json;

 namespace MatterHackers.Agg
@@ -647,6 +649,7 @@
 		}
 	}

+	[TypeConverter(typeof(RGBA_BytesConverter))]
 	public struct RGBA_Bytes : IColorType
 	{
 		public const int cover_shift = 8;
@@ -758,10 +761,10 @@
 			}
 		}

-		public RGBA_Bytes(string HTMLString)
+		public RGBA_Bytes(string htmlString)
 			: this()
 		{
-			Html = HTMLString;
+			Html = htmlString;
 		}

 		public RGBA_Bytes(int r_, int g_, int b_)
@@ -993,6 +996,31 @@
 		}
 	}

+	public class RGBA_BytesConverter : TypeConverter
+	{
+		public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType)
+		{
+			return sourceType == typeof(string) || base.CanConvertFrom(context, sourceType);
+		}
+
+		public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value)
+		{
+			string stringValue = value as string;
+
+
+			if (string.IsNullOrEmpty(stringValue))
+			{
+				return RGBA_Bytes.Transparent;
+			}
+			else if (stringValue.Contains("#"))
+			{
+				return new RGBA_Bytes(stringValue);
+			}
+
+			return base.ConvertFrom(context, culture, value);
+		}
+	}
+
 	public static class ColorExtensionMethods
 	{
 		public static IColorType AdjustSaturation(this IColorType original, double saturationMultiplier)


修改当遇到登录密码错误时计数未实现的问题

修改当遇到登录密码错误时计数未实现的问题

--- src/UserStore.cs
+++ src/UserStore.cs
@@ -577,7 +577,7 @@

         public Task<int> IncrementAccessFailedCountAsync(TUser user)
         {
-            throw new NotImplementedException();
+            return Task<Int32>.FromResult<Int32>(1);
         }

         public Task ResetAccessFailedCountAsync(TUser user)


CreateAppointmentLevelTable

CreateAppointmentLevelTable

git-tfs-id: [https://davidpodhola.visualstudio.com/DefaultCollection]$/Sync.Today/Main/2015;C199

--- tools/sync.today.createdb.core/Schema.cs
+++ tools/sync.today.createdb.core/Schema.cs
@@ -21,6 +21,7 @@
             yield return CreateAccountTable; // David Podhola on Office 365
             yield return CreateServiceAccountTable; // David Podhola login to Exchange/Office 365
             yield return CreateAdapterTable; // Exchange appointments
+            yield return CreateAppointmentLevelTable;
             yield return CreateJournalTable;
             yield return CreateWorkflowTable;
             yield return CreateProcessTable;
@@ -134,6 +135,15 @@
                 new { Name = "nvarchar(255)", Nullable = false }
             );
         }
+
+        public string CreateAppointmentLevelTable()
+        {
+            return seed.CreateTable("AppointmentLevels",
+                new { Id = "int", Identity = true, PrimaryKey = true },
+                new { Name = "nvarchar(255)", Nullable = false }
+            );
+        }
+
         public string CreateServiceAccountTable()
         {
             return seed.CreateTable("ServiceAccounts",


add basic scaling to vfs export.

add basic scaling to vfs export.

2005-02-12  Larry Ewing  <lewing@novell.com>

	* src/VfsExport.cs: add basic scaling to vfs export.

--- src/VfsExport.cs
+++ src/VfsExport.cs
@@ -17,6 +17,8 @@

 		int photo_index;
 		bool open;
+		bool scale;
+		int width, height;

 		FSpot.ThreadProgressDialog progress_dialog;
 		System.Threading.Thread command_thread;
@@ -70,6 +72,49 @@
 			}
 		}

+		public Gnome.Vfs.Result PrepareAndXfer (Photo photo)
+		{
+			Gnome.Vfs.Result result = Gnome.Vfs.Result.Ok;
+			Gnome.Vfs.Uri source = new Gnome.Vfs.Uri (photo.DefaultVersionUri.ToString ());
+			Gnome.Vfs.Uri target = dest.Clone ();
+			target = target.AppendFileName (source.ExtractShortName ());
+			Gnome.Vfs.XferProgressCallback cb = new Gnome.Vfs.XferProgressCallback (Progress);
+
+			//System.Console.WriteLine ("Xfering {0} to {1}", source.ToString (), target.ToString ());
+
+			try {
+				if (scale){
+					progress_dialog.Message = System.String.Format (
+					        Mono.Posix.Catalog.GetString ("Scaling picture \"{0}\""), photo.Name);
+
+					string orig_path = photo.DefaultVersionPath;
+					Exif.ExifData exif_data = new Exif.ExifData (orig_path);
+					Gdk.Pixbuf image = PixbufUtils.LoadAtMaxSize (orig_path, width, height);
+					string version_path = System.IO.Path.GetTempFileName ();
+					PixbufUtils.SaveJpeg (image, version_path, 95, exif_data);
+					source = new Gnome.Vfs.Uri (Gnome.Vfs.Uri.GetUriFromLocalPath (version_path));
+				}
+
+				progress_dialog.Message = System.String.Format (
+					Mono.Posix.Catalog.GetString ("Transferring picture \"{0}\""), photo.Name);
+
+				progress_dialog.Fraction = photo_index / (double) selection.Photos.Length;
+				progress_dialog.ProgressText = System.String.Format (
+					Mono.Posix.Catalog.GetString ("{0} of {1}"), photo_index, selection.Photos.Length);
+
+				result = Gnome.Vfs.Xfer.XferUri (source, target,
+								 Gnome.Vfs.XferOptions.Default,
+								 Gnome.Vfs.XferErrorMode.Abort,
+								 Gnome.Vfs.XferOverwriteMode.Replace,
+								 cb);
+			} finally {
+				if (scale)
+					source.Unlink ();
+			}
+
+			return result;
+		}
+
 		public void Upload ()
 		{
 			try {
@@ -77,23 +122,7 @@
 				Gnome.Vfs.Result result = Gnome.Vfs.Result.Ok;

 				foreach (Photo photo in selection.Photos) {
-					Gnome.Vfs.Uri source = new Gnome.Vfs.Uri (photo.DefaultVersionUri.ToString ());
-					Gnome.Vfs.Uri target = dest.Clone ();
-					target = target.AppendFileName (source.ExtractShortName ());
-					Gnome.Vfs.XferProgressCallback cb = new Gnome.Vfs.XferProgressCallback (Progress);
-
-					//System.Console.WriteLine ("Xfering {0} to {1}", source.ToString (), target.ToString ());
-
-					progress_dialog.Message = System.String.Format (Mono.Posix.Catalog.GetString ("Transferring picture \"{0}\""), photo.Name);
-					progress_dialog.Fraction = photo_index / (double) selection.Photos.Length;
-					progress_dialog.ProgressText = System.String.Format (Mono.Posix.Catalog.GetString ("{0} of {1}"),
-											     photo_index, selection.Photos.Length);
-					result = Gnome.Vfs.Xfer.XferUri (source, target,
-									 Gnome.Vfs.XferOptions.Default,
-									 Gnome.Vfs.XferErrorMode.Abort,
-									 Gnome.Vfs.XferOverwriteMode.Replace,
-									 cb);
-
+					result = PrepareAndXfer (photo);
 					photo_index++;
 				}

@@ -103,13 +132,14 @@
 					progress_dialog.ProgressText = Mono.Posix.Catalog.GetString ("Transfer Complete");
 					progress_dialog.ButtonLabel = Gtk.Stock.Ok;

-								} else {
+				} else {
 					progress_dialog.ProgressText = result.ToString ();
 					progress_dialog.Message = Mono.Posix.Catalog.GetString ("Error While Transferring");
 				}

 				if (open && photo_index > 0)
 					Gnome.Url.Show (dest.ToString ());
+
 			} catch (System.Exception e) {
 				progress_dialog.Message = e.ToString ();
 				progress_dialog.ProgressText = Mono.Posix.Catalog.GetString ("Error Transferring");
@@ -165,7 +195,11 @@

 			dest = new Gnome.Vfs.Uri (uri_entry.Text);
 			open = open_check.Active;
-
+			scale = scale_check.Active;
+			if (scale) {
+				width = 800;
+				height = 800;
+			}
 #if false
 			Upload ();
 #else