ZipFile add summary comments

ZipFile add summary comments

--- src/Zip/ZipFile.cs
+++ src/Zip/ZipFile.cs
@@ -50,6 +50,53 @@

 namespace ICSharpCode.SharpZipLib.Zip
 {
+
+	/// <summary>
+	/// Arguments used with KeysRequiredEvent
+	/// </summary>
+	public class KeysRequiredEventArgs : EventArgs
+	{
+		string fileName;
+
+		/// <summary>
+		/// Get the name of the file for which keys are required.
+		/// </summary>
+		public string FileName
+		{
+			get { return fileName; }
+		}
+
+		byte[] key;
+
+		/// <summary>
+		/// Get/set the key value
+		/// </summary>
+		public byte[] Key
+		{
+			get { return key; }
+			set { key = value; }
+		}
+
+		/// <summary>
+		/// Initialise a new instance of <see cref="KeysRequiredEventArgs"></see>
+		/// </summary>
+		/// <param name="name">The name of the file for which keys are required.</param>
+		public KeysRequiredEventArgs(string name)
+		{
+			fileName = name;
+		}
+
+		/// <summary>
+		/// Initialise a new instance of <see cref="KeysRequiredEventArgs"></see>
+		/// </summary>
+		/// <param name="name">The name of the file for which keys are required.</param>
+		/// <param name="keyValue">The current key value.</param>
+		public KeysRequiredEventArgs(string name, byte[] keyValue)
+		{
+			fileName = name;
+			key = keyValue;
+		}
+	}

 	/// <summary>
 	/// This class represents a Zip archive.  You can ask for the contained
@@ -100,52 +147,37 @@

 		#region KeyHandling

-		public class KeysRequiredEventArgs : EventArgs
-		{
-			string fileName;
-
-			public string FileName
-			{
-				get { return fileName; }
-				set { fileName = value; }
-			}
-
-			byte[] key;
-			public byte[] Key
-			{
-				get { return key; }
-				set { key = value; }
-			}
-
-			public KeysRequiredEventArgs(string name)
-			{
-				fileName = name;
-			}
-
-			public KeysRequiredEventArgs(string name, byte[] keyValue)
-			{
-				fileName = name;
-				key = keyValue;
-				}
-			}
-
-			public delegate void KeysRequiredEventHandler(
-				object sender,
-				KeysRequiredEventArgs e
-			);
-
-			public KeysRequiredEventHandler KeysRequired;
-
-			void OnKeysRequired(string fileName)
-			{
-				if (KeysRequired != null) {
-					KeysRequiredEventArgs krea = new KeysRequiredEventArgs(fileName, key);
-					KeysRequired(this, krea);
-					key = krea.Key;
+		/// <summary>
+		/// Delegate for handling keys/password setting during compresion/decompression.
+		/// </summary>
+		public delegate void KeysRequiredEventHandler(
+			object sender,
+			KeysRequiredEventArgs e
+		);
+
+		/// <summary>
+		/// Event handler for handling encryption keys.
+		/// </summary>
+		public KeysRequiredEventHandler KeysRequired;
+
+		/// <summary>
+		/// Handles getting of encryption keys when required.
+		/// </summary>
+		/// <param name="fileName">The file for which encryptino keys are required.</param>
+		void OnKeysRequired(string fileName)
+		{
+			if (KeysRequired != null) {
+				KeysRequiredEventArgs krea = new KeysRequiredEventArgs(fileName, key);
+				KeysRequired(this, krea);
+				key = krea.Key;
 			}
 		}

 		byte[] key = null;
+
+		/// <summary>
+		/// Get/set the encryption key value.
+		/// </summary>
 		byte[] Key
 		{
 			get { return key; }
@@ -675,7 +707,7 @@
 			CryptoStream result = null;

 			if (entry.Version < ZipConstants.VERSION_STRONG_ENCRYPTION
-             || (entry.Flags & (int)GeneralBitFlags.StrongEncryption) == 0) {
+				|| (entry.Flags & (int)GeneralBitFlags.StrongEncryption) == 0) {
 				PkzipClassicManaged classicManaged = new PkzipClassicManaged();

 				OnKeysRequired(entry.Name);
@@ -917,7 +949,11 @@
 					return (int) amount;
 				}
 			}
-
+
+			/// <summary>
+			/// Read a byte from this stream.
+			/// </summary>
+			/// <returns>Returns the byte read or -1 on end of stream.</returns>
 			public override int ReadByte()
 			{
 				if (filepos == end) {


Adding changes to support the new 0 FieldId.

--- eFormCore/Infrastructure/SqlController.cs
+++ eFormCore/Infrastructure/SqlController.cs
@@ -1128,107 +1128,112 @@
                     {
                         int fieldId = int.Parse(dataItemReply.Id);

-                        Field f = await db.Fields.FirstAsync(x => x.Id == fieldId);
-                        FieldType fieldType = db.FieldTypes.Single(x => x.Id == f.FieldTypeId);
                         FieldValue fieldV = null;
-
-                            if (!fieldTypeIds.Contains((int)f.FieldTypeId))
+                        Field field = await db.Fields.FirstOrDefaultAsync(x => x.Id == fieldId);
+                        var fieldType = fieldId == 0
+                            ? db.FieldTypes.Single(x => x.Type == Constants.Constants.FieldTypes.None)
+                            : db.FieldTypes.Single(x => x.Id == field.FieldTypeId);
+
+                        if (fieldId != 0)
+                        {
+                            if (!fieldTypeIds.Contains((int) field.FieldTypeId))
                             {
-                                fieldV = await db.FieldValues.FirstOrDefaultAsync(x => x.FieldId == fieldId && x.CaseId == caseId && x.CheckListId == checkListId && x.WorkerId == userId);
+                                fieldV = await db.FieldValues.FirstOrDefaultAsync(x =>
+                                    x.FieldId == fieldId && x.CaseId == caseId && x.CheckListId == checkListId &&
+                                    x.WorkerId == userId);
                             }
-
-                            if (fieldV == null)
+                        }
+
+                        if (fieldV == null)
+                        {
+                            fieldV = new FieldValue();
+
+                            //= new field_values();
+
+                            // if contains a file
+                            string urlXml = dataItemReply.URL;
+                            if (urlXml != "" && urlXml != "none" && urlXml != null)
                             {
-                                fieldV = new FieldValue();
-
-                                //= new field_values();
-
-                                // if contains a file
-                                string urlXml = dataItemReply.URL;
-                                if (urlXml != "" && urlXml != "none" && urlXml != null)
+                                string fileLocation = dataItemReply.URL;
+                                Data.Entities.UploadedData dU = await db.UploadedDatas.FirstOrDefaultAsync(x => x.FileLocation == fileLocation);
+                                if (dU == null)
                                 {
-                                    string fileLocation = dataItemReply.URL;
-                                    Data.Entities.UploadedData dU = await db.UploadedDatas.FirstOrDefaultAsync(x => x.FileLocation == fileLocation);
-                                    if (dU == null)
+                                    dU = new Data.Entities.UploadedData
                                     {
-                                        dU = new Data.Entities.UploadedData
-                                        {
-                                            Extension = dataItemReply.Extension,
-                                            UploaderId = userId,
-                                            UploaderType = Constants.Constants.UploaderTypes.System,
-                                            Local = 0,
-                                            FileLocation = fileLocation
-                                        };
-                                        await dU.Create(db).ConfigureAwait(false);
-                                    }
-                                    fieldV.UploadedDataId = dU.Id;
-                                    uploadedDataIds.Add(dU.Id);
-
+                                        Extension = dataItemReply.Extension,
+                                        UploaderId = userId,
+                                        UploaderType = Constants.Constants.UploaderTypes.System,
+                                        Local = 0,
+                                        FileLocation = fileLocation
+                                    };
+                                    await dU.Create(db).ConfigureAwait(false);
                                 }
-                                string extractedValue = dataItemReply.Value.InderValue;
-
-                                if (dataItemReply.Value.InderValue != null)
+                                fieldV.UploadedDataId = dU.Id;
+                                uploadedDataIds.Add(dU.Id);
+
+                            }
+                            string extractedValue = dataItemReply.Value.InderValue;
+
+                            if (dataItemReply.Value.InderValue != null)
+                            {
+
+                                if (fieldType.Type == Constants.Constants.FieldTypes.Number ||
+                                    fieldType.Type == Constants.Constants.FieldTypes.NumberStepper)
                                 {
-
-                                    if (fieldType.Type == Constants.Constants.FieldTypes.Number ||
-                                        fieldType.Type == Constants.Constants.FieldTypes.NumberStepper)
-                                    {
 //                                        extractedValue = extractedValue.Replace(",", "|"); // commented as of 8. oct. 2019
-                                        extractedValue = extractedValue.Replace(".", ",");
-                                    }
+                                    extractedValue = extractedValue.Replace(".", ",");
                                 }
-
-
-                                fieldV.Value = extractedValue;
-                                Field field = await db.Fields.FirstOrDefaultAsync(x => x.Id == fieldId);
-                                fieldType = await db.FieldTypes.FirstAsync(x => x.Id == field.FieldTypeId);
-                                if (fieldType.Type == Constants.Constants.FieldTypes.EntitySearch
-                                    || fieldType.Type == Constants.Constants.FieldTypes.EntitySelect)
+                            }
+
+
+                            fieldV.Value = extractedValue;
+                            if (fieldType.Type == Constants.Constants.FieldTypes.EntitySearch
+                                || fieldType.Type == Constants.Constants.FieldTypes.EntitySelect)
+                            {
+                                if (!string.IsNullOrEmpty(extractedValue) && extractedValue != "null")
                                 {
-                                    if (!string.IsNullOrEmpty(extractedValue) && extractedValue != "null")
-                                    {
-                                        int id = EntityItemRead(extractedValue).GetAwaiter().GetResult().Id;
-                                        fieldV.Value = id.ToString();
-                                    }
+                                    int id = EntityItemRead(extractedValue).GetAwaiter().GetResult().Id;
+                                    fieldV.Value = id.ToString();
                                 }
-
-                                //
-                                //geo
-                                fieldV.Latitude = dataItemReply.Geolocation.Latitude;
-                                fieldV.Longitude = dataItemReply.Geolocation.Longitude;
-                                fieldV.Altitude = dataItemReply.Geolocation.Altitude;
-                                fieldV.Heading = dataItemReply.Geolocation.Heading;
-                                fieldV.Accuracy = dataItemReply.Geolocation.Accuracy;
-                                if (DateTime.TryParse(dataItemReply.Geolocation.Date, out var date))
+                            }
+
+                            //
+                            //geo
+                            fieldV.Latitude = dataItemReply.Geolocation.Latitude;
+                            fieldV.Longitude = dataItemReply.Geolocation.Longitude;
+                            fieldV.Altitude = dataItemReply.Geolocation.Altitude;
+                            fieldV.Heading = dataItemReply.Geolocation.Heading;
+                            fieldV.Accuracy = dataItemReply.Geolocation.Accuracy;
+                            if (DateTime.TryParse(dataItemReply.Geolocation.Date, out var date))
+                            {
+                                fieldV.Date = DateTime.Parse(dataItemReply.Geolocation.Date);
+                            }
+                            else
+                            {
+                                fieldV.Date = null;
+                            }
+                            fieldV.CaseId = responseCase.Id;
+                            fieldV.FieldId = fieldId;
+                            fieldV.WorkerId = userId;
+                            fieldV.CheckListId = clv.CheckListId;
+                            fieldV.DoneAt = _t.Date(response.Checks[xmlIndex].Date);
+
+                            await fieldV.Create(db).ConfigureAwait(false);
+
+                            // remove dataItem duplicate from TemplatDataItemLst
+                            int index = 0;
+                            foreach (var foo in eFormFieldList)
+                            {
+                                if (fieldV.FieldId == foo.Id)
                                 {
-                                    fieldV.Date = DateTime.Parse(dataItemReply.Geolocation.Date);
+                                    eFormFieldList.RemoveAt(index);
+                                    break;
                                 }
-                                else
-                                {
-                                    fieldV.Date = null;
-                                }
-                                fieldV.CaseId = responseCase.Id;
-                                fieldV.FieldId = fieldId;
-                                fieldV.WorkerId = userId;
-                                fieldV.CheckListId = clv.CheckListId;
-                                fieldV.DoneAt = _t.Date(response.Checks[xmlIndex].Date);
-
-                                await fieldV.Create(db).ConfigureAwait(false);
-
-                                // remove dataItem duplicate from TemplatDataItemLst
-                                int index = 0;
-                                foreach (var foo in eFormFieldList)
-                                {
-                                    if (fieldV.FieldId == foo.Id)
-                                    {
-                                        eFormFieldList.RemoveAt(index);
-                                        break;
-                                    }
-
-                                    index++;
-                                }
-                                //
+
+                                index++;
                             }
+                            //
+                        }
                     }

                     foreach (var dataItemReply in elementList.ExtraDataItemList)
@@ -2048,7 +2053,23 @@
             try
             {
                 await using var db = GetContext();
-                Field field = await db.Fields.FirstAsync(x => x.Id == reply.FieldId);
+                Field field = await db.Fields.FirstOrDefaultAsync(x => x.Id == reply.FieldId);
+                if (field == null)
+                {
+                    var result =
+                        await db.FieldValues.FirstAsync(x =>
+                            x.CaseId == reply.CaseId && x.FieldId == reply.FieldId);
+                    return new Models.FieldValue()
+                    {
+                        Id = result.Id,
+                        FieldId = 0,
+                        Value = result.Value,
+                        Accuracy = result.Accuracy,
+                        Latitude = result.Latitude,
+                        Altitude = result.Altitude,
+                        Date = result.Date
+                    };
+                }

                 return await ReadFieldValue(reply, field, joinUploadedData, language);
             }


Fixing the broken code to get subfields inside a FieldGroup.

--- eFormCore/Infrastructure/SqlController.cs
+++ eFormCore/Infrastructure/SqlController.cs
@@ -1556,7 +1556,7 @@
                         {
                             List<DataItem> dataItemSubList = new List<DataItem>();
                             foreach (Data.Entities.Field subField in await db.Fields.Where(x =>
-                                x.ParentFieldId == field.CheckListId).OrderBy(x => x.DisplayIndex).ToListAsync())
+                                x.ParentFieldId == field.Id).OrderBy(x => x.DisplayIndex).ToListAsync())
                             {
                                 Field _field = await DbFieldToField(subField, language);
                                 FieldTranslation fieldTranslation = await db.FieldTranslations.SingleAsync(x =>


Fixing the broken use of the SDK on windows platforms.

--- eFormCore/Infrastructure/SqlController.cs
+++ eFormCore/Infrastructure/SqlController.cs
@@ -85,9 +85,7 @@
         {

             DbContextOptionsBuilder dbContextOptionsBuilder = new DbContextOptionsBuilder();
-            if (log != null) {
-                log.LogStandard("SqlController", "GetContext called");
-            }
+            WriteDebugConsoleLogEntry(new LogEntry(2, "SqlController", "GetContext called")); // This is done to avoid infinite loop

             if (connectionStr.ToLower().Contains("convert zero datetime"))
             {


Added debug logging to setup endpoint, for further tracing.

--- source/Drey.Configuration/Modules/SetupModule.cs
+++ source/Drey.Configuration/Modules/SetupModule.cs
@@ -1,7 +1,7 @@
-using Nancy;
+using Drey.Logging;
+using Nancy;
 using Nancy.ModelBinding;
 using Nancy.Validation;
-
 using System;
 using System.IO;
 using System.Linq;
@@ -11,6 +11,8 @@
 {
     public class SetupModule : NancyModule
     {
+        static readonly ILog _log = LogProvider.For<SetupModule>();
+
         readonly Services.IGlobalSettingsService _globalSettingsService;

         public SetupModule(Services.IGlobalSettingsService globalSettingsService)
@@ -30,11 +32,13 @@

         private dynamic GetIndex(dynamic arg)
         {
+            _log.Debug("Index has been accessed.");
             return View["index", new Services.ViewModels.GlobalSettingsPmo()];
         }

         private dynamic CommitSettings(dynamic arg)
         {
+            _log.Debug("Committing Settings.");
             var settingsPmo = this.BindAndValidate<Services.ViewModels.GlobalSettingsPmo>();

             if (Request.Files.Any())
@@ -60,11 +64,13 @@

         private dynamic UpdateClientCertificate(dynamic arg)
         {
+            _log.Debug("Attempting to update Client Certificate.");
             return Negotiate.WithView("ClientCertificate");
         }

         private dynamic SaveNewClientCertificate(dynamic arg)
         {
+            _log.Debug("Updating new Client Certificate.");
             if (!Request.Files.Any())
             {
                 ModelValidationResult.Errors.Add(string.Empty, "File did not upload.");
@@ -95,11 +101,13 @@

         private dynamic UpdateServerUrl(dynamic arg)
         {
+            _log.Debug("Attempting to update Server Url.");
             return Negotiate.WithView("ServerUrl").WithModel(new Services.ViewModels.ServerHostnamePmo { CurrentHostname = _globalSettingsService.GetServerHostname() });
         }

         private dynamic SaveNewServerUrl(dynamic arg)
         {
+            _log.Debug("Updating Server Url.");
             var model = this.BindAndValidate<Services.ViewModels.ServerHostnamePmo>();

             if (ModelValidationResult.IsValid)


Fixed tests for JsonRequest

Fixed tests for JsonRequest

- Found a new public, fake service that's ideal for this integration test
- PUT + DELETE are now also implemented

--- source/Hanssens.Net.Tests/IO/JsonRequestTests.cs
+++ source/Hanssens.Net.Tests/IO/JsonRequestTests.cs
@@ -1,4 +1,5 @@
 using System;
+using System.Net;
 using FluentAssertions;
 using NUnit.Framework;
 using Hanssens.Net.IO;
@@ -10,24 +11,34 @@
 	{

 		// TODO: The tests below shouldn't call an external service, obviously, but should
-		// be refactored to rely on a more appropriate 'embedded' api. This should also
-		// include writing tests for PUT and DELETE.
+		// be refactored to rely on a more appropriate 'embedded' api.

 		[Test]
 		public void JsonRequest_Delete_Should_Return_Json_String(){
-			Assert.Inconclusive ("TODO: Implement test for JsonRequest.Delete");
+			// arrange
+			var endpoint = @"http://jsonplaceholder.typicode.com/posts/1";
+
+			// act
+			var target = JsonRequest.Delete (endpoint);
+
+			// assert
+			target.Should ().NotBeNull ();
+			target.StatusCode.Should ().Be (HttpStatusCode.OK);
+			target.Success.Should ().BeTrue (because: target.ErrorMessage);
+			target.ErrorMessage.Should ().BeNull ();
 		}

 		[Test]
 		public void JsonRequest_Get_Should_Return_Json_String(){
 			// arrange
-			var endpoint = @"http://ip.jsontest.com/";
+			var endpoint = @"http://jsonplaceholder.typicode.com/posts";

 			// act
 			var target = JsonRequest.Get (endpoint);

 			// assert
 			target.Should ().NotBeNull ();
+			target.StatusCode.Should ().Be (HttpStatusCode.OK);
 			target.Success.Should ().BeTrue (because: target.ErrorMessage);
 			target.Value.Should ().NotBeNullOrEmpty ();
 			target.ErrorMessage.Should ().BeNull ();
@@ -36,13 +47,15 @@
 		[Test]
 		public void JsonRequest_Post_Should_Return_Json_String(){
 			// arrange
-			var endpoint = @"http://ip.jsontest.com/";
+			var endpoint = @"http://jsonplaceholder.typicode.com/posts";
+			var body = new { foo = "Foo", bar = "Bar" };

 			// act
-			var target = JsonRequest.Post (endpoint);
+			var target = JsonRequest.Post (endpoint, args: body);

 			// assert
 			target.Should ().NotBeNull ();
+			target.StatusCode.Should ().Be (HttpStatusCode.Created);
 			target.Success.Should ().BeTrue (because: target.ErrorMessage);
 			target.Value.Should ().NotBeNullOrEmpty ();
 			target.ErrorMessage.Should ().BeNull ();
@@ -50,7 +63,19 @@

 		[Test]
 		public void JsonRequest_Put_Should_Return_Json_String(){
-			Assert.Inconclusive ("TODO: Implement test for JsonRequest.Put");
+			// arrange
+			var endpoint = @"http://jsonplaceholder.typicode.com/posts/1";
+			var body = new { foo = "Foo", bar = "Bar" };
+
+			// act
+			var target = JsonRequest.Put (endpoint, args: body);
+
+			// assert
+			target.Should ().NotBeNull ();
+			target.StatusCode.Should ().Be (HttpStatusCode.OK);
+			target.Success.Should ().BeTrue (because: target.ErrorMessage);
+			target.Value.Should ().NotBeNullOrEmpty ();
+			target.ErrorMessage.Should ().BeNull ();
 		}

 	}


Fix IdUtil tests

Fix IdUtil tests

--- src/ServiceStack.Common/Utils/IdUtils.cs
+++ src/ServiceStack.Common/Utils/IdUtils.cs
@@ -32,17 +32,16 @@
                     && typeof(T).GetProperty(IdUtils.IdField).GetGetMethod() != null)
                 {
                     CanGetId = HasPropertyId<T>.GetId;
+                    return;
                 }
-                else
+
+                foreach (var pi in typeof(T).GetProperties(BindingFlags.Public | BindingFlags.Instance)
+                    .Where(pi => pi.GetCustomAttributes(true)
+                             .Cast<Attribute>()
+                             .Any(attr => attr.GetType().Name == "PrimaryKeyAttribute")))
                 {
-                    foreach (var pi in typeof(T).GetProperties(BindingFlags.Public | BindingFlags.Instance)
-                        .Where(pi => pi.GetCustomAttributes(true)
-                            .Cast<Attribute>()
-                            .Any(attr => attr.GetType().Name == "PrimaryKeyAttribute")))
-                    {
-                        CanGetId = StaticAccessors<T>.ValueUnTypedGetPropertyTypeFn(pi);
-                        return;
-                    }
+                    CanGetId = StaticAccessors<T>.ValueUnTypedGetPropertyTypeFn(pi);
+                    return;
                 }
             }


String: adapted type in corlib, and use it as base for code generation as well. Currently using extra indirection, but might be removed later (or optional?).

--- src/SharpLang.Compiler/Compiler.Class.cs
+++ src/SharpLang.Compiler/Compiler.Class.cs
@@ -261,14 +261,8 @@
                         fieldTypes.Add(parentClass.Type.DataType);
                     }

-                    // Special cases: Array and String
-                    if (typeReference.MetadataType == MetadataType.String)
-                    {
-                        // String: length (int32) + char pointer
-                        fieldTypes.Add(int32Type);
-                        fieldTypes.Add(intPtrType);
-                    }
-                    else if (typeReference.MetadataType == MetadataType.Array)
+                    // Special cases: Array
+                    if (typeReference.MetadataType == MetadataType.Array)
                     {
                         // String: length (native int) + first element pointer
                         var arrayType = (ArrayType)typeReference;


Added ParseJsonToken and LoadJsonToken methods to the JsonUtils class

--- src/Skybrud.Essentials/Json/JsonUtils.cs
+++ src/Skybrud.Essentials/Json/JsonUtils.cs
@@ -15,6 +15,43 @@
     public static class JsonUtils {

         /// <summary>
+        /// Parses the specified <paramref name="json"/> string into an instance <see cref="JToken"/>.
+        /// </summary>
+        /// <param name="json">The JSON string to be parsed.</param>
+        /// <returns>An instance of <see cref="JObject"/> parsed from the specified <paramref name="json"/> string.</returns>
+        public static JToken ParseJsonToken(string json) {
+
+            // JSON.net is automatically parsing strings that look like dates into in actual dates so that we can't
+            // really read as strings without some localization going on. Since this is kinda annoying an we don't
+            // really need it, we can luckily disable it with the lines below
+            return JToken.Load(new JsonTextReader(new StringReader(json)) {
+                DateParseHandling = DateParseHandling.None
+            });
+
+        }
+
+        /// <summary>
+        /// Parses the specified <paramref name="json"/> string into an instance <typeparamref name="T"/>.
+        /// </summary>
+        /// <param name="json">The JSON string to be parsed.</param>
+        /// <returns>An instance of <typeparamref name="T"/> parsed from the specified <paramref name="json"/> string.</returns>
+        public static T ParseJsonToken<T>(string json) {
+            return ParseJsonToken(json).ToObject<T>();
+        }
+
+        /// <summary>
+        /// Parses the specified <paramref name="json"/> string into an instance of <typeparamref name="T"/>.
+        /// </summary>
+        /// <typeparam name="T">The type to be returned.</typeparam>
+        /// <param name="json">The JSON string to be parsed.</param>
+        /// <param name="func">A callback function/method used for converting an instance of <see cref="JToken"/> into
+        /// an instance of <typeparamref name="T"/>.</param>
+        /// <returns>An instance of <typeparamref name="T"/> parsed from the specified <paramref name="json"/> string.</returns>
+        public static T ParseJsonToken<T>(string json, Func<JToken, T> func) {
+            return func(ParseJsonObject(json));
+        }
+
+        /// <summary>
         /// Parses the specified <paramref name="json"/> string into an instance <see cref="JObject"/>.
         /// </summary>
         /// <param name="json">The JSON string to be parsed.</param>
@@ -97,6 +134,36 @@
 #if I_CAN_HAZ_FILE

         /// <summary>
+        /// Loads and parses the JSON token in the file at the specified <paramref name="path"/>.
+        /// </summary>
+        /// <param name="path">The path to the JSON file.</param>
+        /// <returns>An instance of <see cref="JObject"/>.</returns>
+        public static JToken LoadJsonToken(string path) {
+            return ParseJsonToken(File.ReadAllText(path, Encoding.UTF8));
+        }
+
+        /// <summary>
+        /// Loads and parses the JSON object in the file at the specified <paramref name="path"/>.
+        /// </summary>
+        /// <param name="path">The path to the JSON file.</param>
+        /// <returns>An instance of <typeparamref name="T"/>.</returns>
+        public static T LoadJsonToken<T>(string path) {
+            return LoadJsonToken(path).ToObject<T>();
+        }
+
+        /// <summary>
+        /// Loads and parses the JSON object in the file at the specified <paramref name="path"/>.
+        /// </summary>
+        /// <typeparam name="T">The type to be returned.</typeparam>
+        /// <param name="path">The path to the JSON file.</param>
+        /// <param name="func">A callback function/method used for converting an instance of <see cref="JToken"/> into
+        /// an instance of <typeparamref name="T"/>.</param>
+        /// <returns>An instance of <typeparamref name="T"/>.</returns>
+        public static T LoadJsonToken<T>(string path, Func<JToken, T> func) {
+            return ParseJsonToken(File.ReadAllText(path, Encoding.UTF8), func);
+        }
+
+        /// <summary>
         /// Loads and parses the JSON object in the file at the specified <paramref name="path"/>.
         /// </summary>
         /// <param name="path">The path to the JSON file.</param>
@@ -126,7 +193,6 @@
             return ParseJsonObject(File.ReadAllText(path, Encoding.UTF8), func);
         }

-
         /// <summary>
         /// Loads and parses the JSON array in the file at the specified <paramref name="path"/>.
         /// </summary>


chore(): change article class

chore(): change article class

--- src/StockportContentApi/Model/Article.cs
+++ src/StockportContentApi/Model/Article.cs
@@ -24,11 +24,11 @@
         public DateTime SunriseDate { get; }
         public DateTime SunsetDate { get; }
         public DateTime UpdatedAt { get; }
-        public bool ShowLastUpdated { get; set; }
+        public bool HideLastUpdated { get; set; }

         public Article(string body, string slug, string title, string teaser, string metaDescription, string icon, string backgroundImage, string image, List<Section> sections,
             IEnumerable<Crumb> breadcrumbs, IEnumerable<Alert> alerts, IEnumerable<Profile> profiles, Topic parentTopic, List<Document> documents,
-            DateTime sunriseDate, DateTime sunsetDate, IEnumerable<Alert> alertsInline, DateTime updatedAt, bool showLastUpdated)
+            DateTime sunriseDate, DateTime sunsetDate, IEnumerable<Alert> alertsInline, DateTime updatedAt, bool hideLastUpdated)
         {
             Body = body;
             Slug = slug;
@@ -48,7 +48,7 @@
             SunsetDate = sunsetDate;
             AlertsInline = alertsInline;
             UpdatedAt = updatedAt;
-            ShowLastUpdated = showLastUpdated;
+            HideLastUpdated = hideLastUpdated;
         }

         public void ReplaceSection(Section oldSection, Section newSection)


CLEANUP - Removed unused namespace references.

--- src/System.Console/src/System/Console.cs
+++ src/System.Console/src/System/Console.cs
@@ -1,12 +1,8 @@
 // Copyright (c) Microsoft. All rights reserved.
 // Licensed under the MIT license. See LICENSE file in the project root for full license information.

-using System.Diagnostics.Contracts;
 using System.IO;
 using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-using System.Security;
-using System.Text;
 using System.Threading;

 namespace System


Remove unreachable code compiler error for windows.

--- src/System.Private.Uri/src/System/Uri.cs
+++ src/System.Private.Uri/src/System/Uri.cs
@@ -2109,10 +2109,7 @@
                             _flags |= Flags.UncPath;
                             idx = i;

-                            if (!IsWindowsSystem)
-                            {
-                                _syntax = UriParser.UnixFileUri;
-                            }
+                            _syntax = IsWindowsSystem ? _syntax : UriParser.UnixFileUri;
                         }
                         else if (!IsWindowsSystem && _syntax.InFact(UriSyntaxFlags.FileLikeUri) && pUriString[i - 1] == '/' && i - idx == 3)
                         {


Add optional offset to Pin in System.Runtime ref.

--- src/System.Runtime/ref/System.Runtime.cs
+++ src/System.Runtime/ref/System.Runtime.cs
@@ -3889,7 +3889,7 @@
         public abstract Span<T> Span { get; }
         public void Dispose() { throw null; }
         protected abstract void Dispose(bool disposing);
-        public abstract MemoryHandle Pin();
+        public abstract MemoryHandle Pin(int offset = 0);
         public abstract bool Release();
         public abstract void Retain();
         protected internal abstract bool TryGetArray(out ArraySegment<T> arraySegment);


configuration files for different enviroments .

--- dotnet-flubu/Commanding/FlubuConfigurationProvider.cs
+++ dotnet-flubu/Commanding/FlubuConfigurationProvider.cs
@@ -15,10 +15,19 @@
             try
             {
                 var builder = new ConfigurationBuilder();
-                var config = builder.SetBasePath(Directory.GetCurrentDirectory())
+                builder.SetBasePath(Directory.GetCurrentDirectory())
                     .AddEnvironmentVariables("flubu_")
-                    .AddJsonFile(jsonSettingsFile, optional: true)
-                    .Build();
+                    .AddJsonFile(jsonSettingsFile, optional: true);
+
+                string environment = Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT");
+                if (!string.IsNullOrEmpty(environment))
+                {
+                    var jsonSettingsEnvFile = Path.GetFileNameWithoutExtension(jsonSettingsFile);
+                    jsonSettingsEnvFile = $"{jsonSettingsEnvFile}.{environment}.json";
+                    builder.AddJsonFile(jsonSettingsEnvFile, optional: true);
+                }
+
+                var config = builder.Build();

                 Dictionary<string, string> dic = new Dictionary<string, string>();
                 config.Bind(dic);


Handle max runtime level for components

Handle max runtime level for components

--- src/Umbraco.Core/Components/Composers.cs
+++ src/Umbraco.Core/Components/Composers.cs
@@ -76,11 +76,13 @@
             var composerTypeList = _composerTypes
                 .Where(x =>
                 {
-                    // use the min level specified by the attribute if any
-                    // otherwise, user composers have Run min level, anything else is Unknown (always run)
+                    // use the min/max levels specified by the attribute if any
+                    // otherwise, min: user composers are Run, anything else is Unknown (always run)
+                    //            max: everything is Run (always run)
                     var attr = x.GetCustomAttribute<RuntimeLevelAttribute>();
                     var minLevel = attr?.MinLevel ?? (x.Implements<IUserComposer>() ? RuntimeLevel.Run : RuntimeLevel.Unknown);
-                    return _composition.RuntimeState.Level >= minLevel;
+                    var maxLevel = attr?.MaxLevel ?? RuntimeLevel.Run;
+                    return _composition.RuntimeState.Level >= minLevel && _composition.RuntimeState.Level <= maxLevel;
                 })
                 .ToList();


ensures the templates are sorted by name

--- src/Umbraco.Core/Services/FileService.cs
+++ src/Umbraco.Core/Services/FileService.cs
@@ -247,7 +247,7 @@
         {
             using (var repository = _repositoryFactory.CreateTemplateRepository(_dataUowProvider.GetUnitOfWork()))
             {
-                return repository.GetAll(aliases);
+                return repository.GetAll(aliases).OrderBy(x => x.Name);
             }
         }

@@ -259,7 +259,7 @@
         {
             using (var repository = _repositoryFactory.CreateTemplateRepository(_dataUowProvider.GetUnitOfWork()))
             {
-                return repository.GetChildren(masterTemplateId);
+                return repository.GetChildren(masterTemplateId).OrderBy(x => x.Name);
             }
         }


workingOnXMLCreateInDB

workingOnXMLCreateInDB

--- eFormSDK.Integration.Tests/CoreTesteFormCreateInDB.cs
+++ eFormSDK.Integration.Tests/CoreTesteFormCreateInDB.cs
@@ -93,44 +93,51 @@
                     </ElementList>
                 </Main>";
             //Act
-            var match = sut.TemplateFromXml(xmlstring);
+            MainElement mainElement = sut.TemplateFromXml(xmlstring);
+            int eFormId = sut.TemplateCreate(mainElement);
+            List<check_lists> cl = DbContext.check_lists.AsNoTracking().ToList();

             //Assert
-            Assert.NotNull(match);
-            Assert.AreEqual("", match.CaseType);
-            Assert.AreEqual(1, match.Repeated);
-            Assert.AreEqual(1, match.Id);
-            Assert.AreEqual("CommentMain", match.Label);
-            Assert.AreEqual("da", match.Language);
-            Assert.AreEqual(false, match.MultiApproval);
-            Assert.AreEqual(false, match.FastNavigation);
-            Assert.AreEqual(0, match.DisplayOrder);
-            Assert.AreEqual(1, match.ElementList.Count());
-            DataElement dE = (DataElement)match.ElementList[0];
-            Assert.AreEqual(dE.DataItemList.Count(), 1);
-            Assert.AreEqual("CommentDataElement", dE.Label);
-
-            CDataValue cd = new CDataValue();
+            Assert.NotNull(cl);
+            Assert.AreEqual("", cl[0].case_type);
+            Assert.AreEqual(1, cl[0].repeated);
+            //Assert.AreEqual(1, cl[0].id);
+            Assert.AreEqual("CommentMain", cl[0].label);
+            //Assert.AreEqual("da", match.Language);
+            Assert.AreEqual(0, cl[0].multi_approval); //false
+            Assert.AreEqual(0, cl[0].fast_navigation); //false
+            Assert.AreEqual(0, cl[0].display_index);
+            //Assert.AreEqual(1, match.ElementList.Count());
+            //DataElement dE = (DataElement)cl[1];
+            Assert.AreEqual(2, cl.Count);
+            Assert.AreEqual("CommentDataElement", cl[1].label);
+
+            //CDataValue cd = new CDataValue();

             //Assert.AreEqual(dE.Description, cd); TODO
-            Assert.AreEqual(0, dE.DisplayOrder);
-            Assert.AreEqual(false, dE.ReviewEnabled);
-            //Assert.AreEqual(dE.ManualSync) //TODO No Method for ManualSync
-            Assert.AreEqual(false, dE.ExtraFieldsEnabled);
-            //Assert.AreEqual(dE.DoneButtonDisabled, false); //TODO DoneButtonDisabled no method found
-            Assert.AreEqual(false, dE.ApprovalEnabled);
-
-            Comment commentField = (Comment)dE.DataItemList[0];
-            Assert.AreEqual("CommentField", commentField.Label);
+            Assert.AreEqual(0, cl[1].display_index);
+            Assert.AreEqual(0, cl[1].review_enabled); //False
+            //Assert.AreEqual(0, cl[1].manual_sync); //false TODO was null
+            Assert.AreEqual(0, cl[1].extra_fields_enabled); //False
+            //Assert.AreEqual(0, cl[1].done_button_Disabled); //TODO no method
+            Assert.AreEqual(0, cl[1].approval_enabled); //False
+
+            List<fields> _fields = DbContext.fields.AsNoTracking().ToList();
+
+            Assert.NotNull(_fields);
+            Assert.AreEqual(1, _fields.Count());
+            Assert.AreEqual(cl[1].id, _fields[0].check_list_id);
+            //Comment commentField = (Comment)dE.DataItemList[0];
+            Assert.AreEqual("CommentField", _fields[0].label);
             //Assert.AreEqual(commentField.Description, cd);
-            Assert.AreEqual(0, commentField.DisplayOrder);
-            //Assert.AreEqual(commentField.Multi, 0) //TODO No method MULTI
-            //Assert.AreEqual(commentField.geolocation, false) //TODO no method geolocation
-            //Assert.AreEqual(commentField.Split, false) //TODO no method Split
-            Assert.AreEqual("", commentField.Value);
-            Assert.AreEqual(false, commentField.ReadOnly);
-            Assert.AreEqual(false, commentField.Mandatory);
-            Assert.AreEqual(Constants.FieldColors.Grey, commentField.Color);
+            Assert.AreEqual(0, _fields[0].display_index);
+            //Assert.AreEqual(1, _fields[0].multi); was null TODO
+            //Assert.AreEqual(0, _fields[0].geolocation_enabled); //False TODO was null
+            Assert.AreEqual(0, _fields[0].split_screen); //TODO no method Split
+            Assert.AreEqual("", _fields[0].default_value);
+            Assert.AreEqual(0, _fields[0].read_only); //false
+            Assert.AreEqual(0, _fields[0].mandatory); //false
+            Assert.AreEqual(Constants.FieldColors.Grey, _fields[0].color);

         }


Fix CI error.

Fix CI error.

--- osu.Framework.Testing/TestCaseTestRunner.cs
+++ osu.Framework.Testing/TestCaseTestRunner.cs
@@ -71,7 +71,7 @@
                     }, time_between_tests);
                 }, e =>
                 {
-                    // Other tests may run even if this one failed, so the TestCase still needs to be removed
+                    // Other tests may run even if this one failed, so the TestCase still needs to be removed
                     Remove(test);
                     throw new Exception("The test case threw an exception while running", e);
                 });


Remove redundant comments

Remove redundant comments

--- osu.Framework/Platform/SDL2DesktopWindow.cs
+++ osu.Framework/Platform/SDL2DesktopWindow.cs
@@ -1107,13 +1107,11 @@
             {
                 case WindowState.Fullscreen:
                     if (!updateDisplayMode(true))
-                        // if we failed to get the fullscreen mode, query the desktop mode so that we always have an up-to-date display mode.
                         updateDisplayMode(false);
                     break;

                 default:
                     if (!updateDisplayMode(false))
-                        // if we failed to get the desktop mode, query the fullscreen mode so that we always have an up-to-date display mode.
                         updateDisplayMode(true);
                     break;
             }


Throw if RelativeMouseMode is set to an invalid state

This should never really be reached, unless a user tried to change it
directly on the window. Which isn't really a supported operation as the
`MouseHandler` will overwrite this change soon after.

--- osu.Framework/Platform/SDL2DesktopWindow.cs
+++ osu.Framework/Platform/SDL2DesktopWindow.cs
@@ -123,6 +123,9 @@
                 if (relativeMouseMode == value)
                     return;

+                if (value && !CursorState.HasFlagFast(CursorState.Hidden))
+                    throw new InvalidOperationException($"Cannot set {nameof(RelativeMouseMode)} to true when the cursor is not hidden via {nameof(CursorState)}.");
+
                 relativeMouseMode = value;
                 ScheduleCommand(() => SDL.SDL_SetRelativeMouseMode(value ? SDL.SDL_bool.SDL_TRUE : SDL.SDL_bool.SDL_FALSE));
             }


Remove scaling from the window size bindable

--- osu.Framework/Platform/SDL2DesktopWindow.cs
+++ osu.Framework/Platform/SDL2DesktopWindow.cs
@@ -412,6 +412,7 @@
             graphicsBackend.Initialise(this);

             updateWindowSpecifics();
+            updateWindowSize();
             WindowMode.TriggerChange();
         }

@@ -479,7 +480,7 @@
                 if (windowState == WindowState.Normal)
                 {
                     windowStateChanging = true;
-                    sizeWindowed.Value = newSize;
+                    sizeWindowed.Value = scaleSize(newSize, 1 / Scale);
                     windowStateChanging = false;
                 }

@@ -968,13 +969,13 @@
             switch (windowState)
             {
                 case WindowState.Normal:
-                    Size = sizeWindowed.Value;
+                    Size = scaleSize(sizeWindowed.Value, Scale);

                     SDL.SDL_SetWindowBordered(SDLWindowHandle, SDL.SDL_bool.SDL_TRUE);
                     SDL.SDL_SetWindowFullscreen(SDLWindowHandle, (uint)SDL.SDL_bool.SDL_FALSE);
                     SDL.SDL_RestoreWindow(SDLWindowHandle);

-                    SDL.SDL_SetWindowSize(SDLWindowHandle, Size.Width, Size.Height);
+                    SDL.SDL_SetWindowSize(SDLWindowHandle, sizeWindowed.Value.Width, sizeWindowed.Value.Height);

                     updateWindowPositionFromConfig();
                     break;


Add null check in dispose

Add null check in dispose

--- osu.Framework/Testing/TestCaseTestRunner.cs
+++ osu.Framework/Testing/TestCaseTestRunner.cs
@@ -46,7 +46,7 @@

             protected override void Dispose(bool isDisposing)
             {
-                volume.Value = volumeAtStartup;
+                if (volume != null) volume.Value = volumeAtStartup;
                 base.Dispose(isDisposing);
             }


Show skinnable test skin names and autosized component sizes

--- osu.Game/Tests/Visual/SkinnableTestScene.cs
+++ osu.Game/Tests/Visual/SkinnableTestScene.cs
@@ -7,9 +7,13 @@
 using osu.Framework.Audio;
 using osu.Framework.Graphics;
 using osu.Framework.Graphics.Containers;
+using osu.Framework.Graphics.Shapes;
 using osu.Framework.Graphics.Textures;
 using osu.Framework.IO.Stores;
+using osu.Game.Graphics.Sprites;
 using osu.Game.Skinning;
+using osuTK;
+using osuTK.Graphics;

 namespace osu.Game.Tests.Visual
 {
@@ -30,10 +34,10 @@
         {
             var dllStore = new DllResourceStore(GetType().Assembly);

-            metricsSkin = new TestLegacySkin(new SkinInfo(), new NamespacedResourceStore<byte[]>(dllStore, "Resources/metrics_skin"), audio, true);
+            metricsSkin = new TestLegacySkin(new SkinInfo { Name = "metrics-skin" }, new NamespacedResourceStore<byte[]>(dllStore, "Resources/metrics_skin"), audio, true);
             defaultSkin = skinManager.GetSkin(DefaultLegacySkin.Info);
-            specialSkin = new TestLegacySkin(new SkinInfo(), new NamespacedResourceStore<byte[]>(dllStore, "Resources/special_skin"), audio, true);
-            oldSkin = new TestLegacySkin(new SkinInfo(), new NamespacedResourceStore<byte[]>(dllStore, "Resources/old_skin"), audio, true);
+            specialSkin = new TestLegacySkin(new SkinInfo { Name = "special-skin" }, new NamespacedResourceStore<byte[]>(dllStore, "Resources/special_skin"), audio, true);
+            oldSkin = new TestLegacySkin(new SkinInfo { Name = "old-skin" }, new NamespacedResourceStore<byte[]>(dllStore, "Resources/old_skin"), audio, true);
         }

         public void SetContents(Func<Drawable> creationFunction)
@@ -47,13 +51,76 @@

         private Drawable createProvider(Skin skin, Func<Drawable> creationFunction)
         {
-            var mainProvider = new SkinProvidingContainer(skin);
+            var created = creationFunction();
+            var autoSize = created.RelativeSizeAxes == Axes.None;

-            return mainProvider
-                .WithChild(new SkinProvidingContainer(Ruleset.Value.CreateInstance().CreateLegacySkinProvider(mainProvider))
+            var mainProvider = new SkinProvidingContainer(skin)
+            {
+                RelativeSizeAxes = !autoSize ? Axes.Both : Axes.None,
+                AutoSizeAxes = autoSize ? Axes.Both : Axes.None,
+            };
+
+            return new Container
+            {
+                RelativeSizeAxes = Axes.Both,
+                BorderColour = Color4.White,
+                BorderThickness = 5,
+                Masking = true,
+
+                Children = new Drawable[]
                 {
-                    Child = creationFunction()
-                });
+                    new Box
+                    {
+                        AlwaysPresent = true,
+                        Alpha = 0,
+                        RelativeSizeAxes = Axes.Both,
+                    },
+                    new OsuSpriteText
+                    {
+                        Text = skin?.SkinInfo?.Name ?? "none",
+                        Scale = new Vector2(1.5f),
+                        Padding = new MarginPadding(5),
+                    },
+                    new Container
+                    {
+                        RelativeSizeAxes = !autoSize ? Axes.Both : Axes.None,
+                        AutoSizeAxes = autoSize ? Axes.Both : Axes.None,
+                        Anchor = Anchor.Centre,
+                        Origin = Anchor.Centre,
+                        Children = new Drawable[]
+                        {
+                            new OutlineBox { Alpha = autoSize ? 1 : 0 },
+                            mainProvider.WithChild(
+                                new SkinProvidingContainer(Ruleset.Value.CreateInstance().CreateLegacySkinProvider(mainProvider))
+                                {
+                                    Child = created,
+                                    RelativeSizeAxes = !autoSize ? Axes.Both : Axes.None,
+                                    AutoSizeAxes = autoSize ? Axes.Both : Axes.None,
+                                }
+                            )
+                        }
+                    },
+                }
+            };
+        }
+
+        private class OutlineBox : CompositeDrawable
+        {
+            public OutlineBox()
+            {
+                BorderColour = Color4.IndianRed;
+                BorderThickness = 5;
+                Masking = true;
+                RelativeSizeAxes = Axes.Both;
+
+                InternalChild = new Box
+                {
+                    RelativeSizeAxes = Axes.Both,
+                    Alpha = 0,
+                    Colour = Color4.Brown,
+                    AlwaysPresent = true
+                };
+            }
         }

         private class TestLegacySkin : LegacySkin


Fix image view not popping up in StatusPage for other posts

--- WinMasto/Views/StatusPage.xaml.cs
+++ WinMasto/Views/StatusPage.xaml.cs
@@ -95,6 +95,14 @@
                 var grid = sender as AdaptiveGridView;
                 if (grid == null) return;

+                var inlineStatus = grid.DataContext as Status;
+                if (inlineStatus != null) {
+                    ImageGalleryView.ViewModel.SetStatus(inlineStatus, attachment);
+                    FlyoutBase flyoutBase2 = FlyoutBase.GetAttachedFlyout(StatusPageGrid);
+                    flyoutBase2.ShowAt(StatusPageGrid);
+                    return;
+                }
+
                 var status = grid.DataContext as StatusPageViewModel;
                 if (status == null) return;
                 ImageGalleryView.ViewModel.SetStatus(status.SelectedStatus, attachment);


changing to three segment versioning

changing to three segment versioning

--- src/UrlFilter/Properties/AssemblyInfo.cs
+++ src/UrlFilter/Properties/AssemblyInfo.cs
@@ -26,6 +26,6 @@
 // You can specify all the values or you can default the Build and Revision Numbers
 // by using the '*' as shown below:
 // [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.0.1.*")]
-[assembly: AssemblyInformationalVersion("1.0.0.*")]
+[assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyInformationalVersion("1.0.*")]
 [assembly: AssemblyFileVersion("1.0.1.0")]


Implemented vector rotation.

Implemented vector rotation.

--- Xemio.GameLibrary/Math/Vector2.cs
+++ Xemio.GameLibrary/Math/Vector2.cs
@@ -174,6 +174,18 @@
             return result;
         }
         /// <summary>
+        /// Rotates the specified vector.
+        /// </summary>
+        /// <param name="vector">The vector.</param>
+        /// <param name="angle">The angle.</param>
+        public static Vector2 Rotate(Vector2 vector, float angle)
+        {
+            float rx = vector.X * MathHelper.Cos(angle) - vector.Y * MathHelper.Sin(angle);
+            float ry = vector.X * MathHelper.Sin(angle) + vector.Y * MathHelper.Cos(angle);
+
+            return new Vector2(rx, ry);
+        }
+        /// <summary>
         /// Rounds the specified vector.
         /// </summary>
         /// <param name="vector">The vector.</param>


[WIN-5716] macOS: Mouse drag operations don't work (resize splitter, drag and drop of tabs, etc)

--- Xwt.XamMac/Xwt.Mac/IViewObject.cs
+++ Xwt.XamMac/Xwt.Mac/IViewObject.cs
@@ -87,8 +87,8 @@
 			if (view.View == null)
 				throw new InvalidOperationException ();
 			CGPoint p = view.View.ConvertPointFromEvent (theEvent);
-			if (!view.View.Bounds.Contains (p))
-				return false;
+			// Do not test if the view contains the point - if this message is being received it may be because the view has the mouse
+			// focus since it was under the mouse when the down event fired
 			ButtonEventArgs args = new ButtonEventArgs ();
 			args.X = p.X;
 			args.Y = p.Y;
@@ -123,8 +123,8 @@
 			if (view.View == null)
 				throw new InvalidOperationException ();
 			CGPoint p = view.View.ConvertPointFromEvent (theEvent);
-			if (!view.View.Bounds.Contains (p))
-				return false;
+			// Do not test if the view contains the point - if this message is being received it may be because the view has the mouse
+			// focus since it was under the mouse when the down event fired
 			MouseMovedEventArgs args = new MouseMovedEventArgs ((long)TimeSpan.FromSeconds (theEvent.Timestamp).TotalMilliseconds, p.X, p.Y);
 			view.Backend.ApplicationContext.InvokeUserCode (delegate {
 				view.Backend.EventSink.OnMouseMoved (args);


Fix spacing

Fix spacing

--- Xwt.XamMac/Xwt.Mac/ViewBackend.cs
+++ Xwt.XamMac/Xwt.Mac/ViewBackend.cs
@@ -550,13 +550,12 @@
 			lock (typesConfiguredForDragDrop) {
 				if (typesConfiguredForDragDrop.Add (type)) {
 					Class c = new Class (type);
-
-                    c.AddMethod (draggingEnteredSel.Handle, draggingEnteredDelegate, "i@:@");
-                    c.AddMethod (draggingUpdatedSel.Handle, draggingUpdatedDelegate, "i@:@");
-                    c.AddMethod (draggingExitedSel.Handle, draggingExitedDelegate, "v@:@");
-                    c.AddMethod (prepareForDragOperationSel.Handle, prepareForDragOperationDelegate, "B@:@");
-                    c.AddMethod (performDragOperationSel.Handle, performDragOperationDelegate, "B@:@");
-                    c.AddMethod (concludeDragOperationSel.Handle, delegateIntPtrIntPtrIntPtrVoid, "v@:@");
+					c.AddMethod (draggingEnteredSel.Handle, draggingEnteredDelegate, "i@:@");
+					c.AddMethod (draggingUpdatedSel.Handle, draggingUpdatedDelegate, "i@:@");
+					c.AddMethod (draggingExitedSel.Handle, draggingExitedDelegate, "v@:@");
+					c.AddMethod (prepareForDragOperationSel.Handle, prepareForDragOperationDelegate, "B@:@");
+					c.AddMethod (performDragOperationSel.Handle, performDragOperationDelegate, "B@:@");
+					c.AddMethod (concludeDragOperationSel.Handle, delegateIntPtrIntPtrIntPtrVoid, "v@:@");
 				}
 			}
 		}
@@ -575,7 +574,7 @@
 				if (typesConfiguredForFocusEvents.Add (type)) {
 					Class c = new Class (type);
 					c.AddMethod (becomeFirstResponderSel.Handle, onBecomeFirstResponderDelegate, "B@:");
-                    c.AddMethod (resignFirstResponderSel.Handle, onResignFirstResponderDelegate, "B@:");
+					c.AddMethod (resignFirstResponderSel.Handle, onResignFirstResponderDelegate, "B@:");
 				}
 			}
 		}


Win32 implementation now checks the previous ShowWindowCommand and sets it back to that after hiding.

--- src/Windows/Avalonia.Win32/WindowImpl.cs
+++ src/Windows/Avalonia.Win32/WindowImpl.cs
@@ -763,10 +763,14 @@
             else
                 style &= ~(UnmanagedMethods.WindowStyles.WS_EX_APPWINDOW);

-            //Toggle to make the styles stick
-            UnmanagedMethods.ShowWindow(_hwnd, ShowWindowCommand.Hide);
-            UnmanagedMethods.SetWindowLong(_hwnd, -20, (uint)style);
-            UnmanagedMethods.ShowWindow(_hwnd, ShowWindowCommand.Show);
+            WINDOWPLACEMENT windowPlacement = new WINDOWPLACEMENT();
+            if (UnmanagedMethods.GetWindowPlacement(_hwnd, ref windowPlacement))
+            {
+                //Toggle to make the styles stick
+                UnmanagedMethods.ShowWindow(_hwnd, ShowWindowCommand.Hide);
+                UnmanagedMethods.SetWindowLong(_hwnd, -20, (uint)style);
+                UnmanagedMethods.ShowWindow(_hwnd, windowPlacement.ShowCmd);
+            }
         }
     }
 }


Fixed IsFat property in CilMethodBody.

Fixed IsFat property in CilMethodBody.

As ECMA states, "Tiny headers" use 6-bit length encoding, therefore the length should be not longer than 63. Previous code would categorize a body with a length of 64 as "Tiny", while it is actually a "Fat" format. This would lead to an ArgumentException on writing.

--- src/AsmResolver.DotNet/Code/Cil/CilMethodBody.cs
+++ src/AsmResolver.DotNet/Code/Cil/CilMethodBody.cs
@@ -282,7 +282,7 @@
                     return false;

                 var last = Instructions[Instructions.Count - 1];
-                return last.Offset + last.Size > 64;
+                return last.Offset + last.Size >= 64;
             }
         }


Exposed Game Context on Xamarin.Forms.

Exposed Game Context on Xamarin.Forms.

--- src/Xamarin.Forms.Platforms.Xna/Forms.cs
+++ src/Xamarin.Forms.Platforms.Xna/Forms.cs
@@ -2,6 +2,7 @@
 {
     using Microsoft.Xna.Framework;
     using Xamarin.Forms.Platforms.Xna;
+    using Xamarin.Forms.Platforms.Xna.Context;

     public static class Forms
     {
@@ -10,12 +11,21 @@
         public static Game Game { get; private set; }
         public static IPlatformEngine PlatformEngine { get; private set; }

+#if !INTERNAL_CONTEXT
+        public static GameContext DrawContext { get; private set; }
+        public static GameContext UpdateContext { get; private set; }
+#endif
+
         public static void Init(Game game)
         {
             if (IsInitialized)
                 return;

             PlatformServices platformServices = new PlatformServices(game);
+#if !INTERNAL_CONTEXT
+            DrawContext = platformServices.DrawContext;
+            UpdateContext = platformServices.UpdateContext;
+#endif

             game.Components.Add(platformServices);
             Device.PlatformServices = platformServices;


Implement measure pass in AdornerLayer.

Implement measure pass in AdornerLayer.

Previously the `AdornerLayer` was falling back to the base class implementation of `MeasureOverride`, in `Canvas`. This meant that at times, adorner controls were being measured with a larger constraint than the final size given to them. `Grid` doesn't like it when this happens which causes problems with various controls.

Add a measure pass to `AdornerLayer` which passes the adorned control's bounds as the constraint (which is the value that the arrange pass will use).

--- src/Avalonia.Controls/Primitives/AdornerLayer.cs
+++ src/Avalonia.Controls/Primitives/AdornerLayer.cs
@@ -1,6 +1,7 @@
 using System;
 using System.Collections.Specialized;
 using System.Linq;
+using System.Resources;
 using Avalonia.Media;
 using Avalonia.Rendering;
 using Avalonia.Utilities;
@@ -45,10 +46,27 @@
                 ?.AdornerLayer;
         }

+        protected override Size MeasureOverride(Size availableSize)
+        {
+            foreach (var child in Children)
+            {
+                var info = child.GetValue(s_adornedElementInfoProperty);
+
+                if (info != null && info.Bounds.HasValue)
+                {
+                    child.Measure(info.Bounds.Value.Bounds.Size);
+                }
+                else
+                {
+                    child.Measure(availableSize);
+                }
+            }
+
+            return default;
+        }
+
         protected override Size ArrangeOverride(Size finalSize)
         {
-            var parent = Parent;
-
             foreach (var child in Children)
             {
                 var info = child.GetValue(s_adornedElementInfoProperty);


fixing a comment typo

fixing a comment typo

--- src/Discord.Net/WebSocket/DiscordSocketClient.cs
+++ src/Discord.Net/WebSocket/DiscordSocketClient.cs
@@ -38,7 +38,7 @@
         private int _nextAudioId;
         private bool _canReconnect;

-        /// <summary> Gets the shard if of this client. </summary>
+        /// <summary> Gets the shard id of this client. </summary>
         public int ShardId { get; }
         /// <summary> Gets the current connection state of this client. </summary>
         public ConnectionState ConnectionState { get; private set; }


Removed non-existent parameter doc.

Removed non-existent parameter doc.

--- src/GitHub.App/ViewModels/PullRequestFileNode.cs
+++ src/GitHub.App/ViewModels/PullRequestFileNode.cs
@@ -21,7 +21,6 @@
         /// <param name="sha">The SHA of the file.</param>
         /// <param name="status">The way the file was changed.</param>
         /// <param name="statusDisplay">The string to display in the [message] box next to the filename.</param>
-        /// <param name="commentCount">The number of review comments on the file.</param>
         public PullRequestFileNode(
             string repositoryPath,
             string path,


fix check on ios

fix check on ios

--- src/ImageButton.iOS/ImageButtonImplementation.cs
+++ src/ImageButton.iOS/ImageButtonImplementation.cs
@@ -112,7 +112,7 @@
             }

-            if (Element == null || !Equals(Element.Source, imageSource))
+            if (Element == null)
             {
                 image?.Dispose();
                 return null;


Fix type name for external assemblies

Fix type name for external assemblies

--- src/IonFar.SharePoint.Migration/MigrationInfo.cs
+++ src/IonFar.SharePoint.Migration/MigrationInfo.cs
@@ -47,7 +47,7 @@
         /// <param name="migrationType">The type containing the migration.</param>
         public MigrationInfo(Type migrationType)
         {
-            MigrationType = migrationType.FullName;
+            MigrationType = migrationType.AssemblyQualifiedName;
             FullName = migrationType.FullName;
             var migrationAttribute = migrationType.GetCustomAttribute<MigrationAttribute>(inherit: true);
             if (migrationAttribute != null)


Fix order of assertion and usage in BMFontConfig.ParseConfigFile

--- src/label_nodes/CCBMFontConfiguration.cs
+++ src/label_nodes/CCBMFontConfiguration.cs
@@ -80,9 +80,9 @@

         private List<int> ParseConfigFile(string pBuffer, string fntFile)
         {
+            Debug.Assert(pBuffer != null, "CCBMFontConfiguration::parseConfigFile | Open file error.");
+
             long nBufSize = pBuffer.Length;
-
-            Debug.Assert(pBuffer != null, "CCBMFontConfiguration::parseConfigFile | Open file error.");

             if (string.IsNullOrEmpty(pBuffer))
             {


wp8: multi-button (>4) toolbar impl fixed; nicer text captions for custom actions

--- platform/wp8/rhodes/MainPage.xaml.cs
+++ platform/wp8/rhodes/MainPage.xaml.cs
@@ -52,6 +52,7 @@
         private Dictionary<string, int> menuItems = new Dictionary<string, int>();
         // toolbar items hash table
         private Dictionary<string, string> toolbarItems = new Dictionary<string, string>();
+        private List<ApplicationBarMenuItem> toolbarMenuItems = new List<ApplicationBarMenuItem>();

         private bool isUIThread
         {
@@ -337,6 +338,18 @@
             if (!isUIThread) { Dispatcher.BeginInvoke(delegate() { toolbarRemoveAllButtons(); }); return; }
             ApplicationBar.Buttons.Clear();
             toolbarItems.Clear();
+            // remove all toolbar items added to menu (wp8 toolbar allows 4 buttons only)
+            int j = toolbarMenuItems.Count-1;
+            if (j >= 0) {
+                for (int i = ApplicationBar.MenuItems.Count - 1; i >= 0; i--) {
+                    if (ApplicationBar.MenuItems[i].Equals(toolbarMenuItems[j])) {
+                        ApplicationBar.MenuItems.RemoveAt(i);
+                        if ((--j) < 0)
+                            break;
+                    }
+                }
+            }
+            toolbarMenuItems.Clear();
             updateAppBarModeAndVisibility();
         }

@@ -371,8 +384,15 @@
         {
             if ((action == null) || (action.Length == 0))
                 return;
-            if ((text == null) || (text.Length == 0))
+            if ((text == null) || (text.Length == 0)) {
                 text = action;
+                if (text.IndexOf('/') >= 0) {
+                    while (text.EndsWith("/"))
+                        text.Remove(text.Length-1);
+                    if (text.LastIndexOf('/') >= 0)
+                        text = text.Substring(text.LastIndexOf('/') + 1);
+                }
+            }
             if (!isUIThread) { Dispatcher.BeginInvoke(delegate() { toolbarAddAction(icon, text, action); }); return; }
             if (ApplicationBar.Buttons.Count < 4)
             {
@@ -387,6 +407,7 @@
                 ApplicationBarMenuItem menuItem = new ApplicationBarMenuItem(text);
                 ApplicationBar.MenuItems.Add(menuItem);
                 menuItem.Click += new EventHandler(toolbarMenuItem_Click);
+                toolbarMenuItems.Add(menuItem);
             }
             toolbarItems.Add(text, action);
             updateAppBarModeAndVisibility();
@@ -421,6 +442,8 @@
         {
             if (!isUIThread) { Dispatcher.BeginInvoke(delegate() { menuClear(); }); return; }
             ApplicationBar.MenuItems.Clear();
+            // restore menu items converted from toolbar buttons (wp8 allows 4 actual buttons only)
+            toolbarMenuItems.ForEach(item => ApplicationBar.MenuItems.Add(item));
             menuItems.Clear();
             updateAppBarModeAndVisibility();
         }


Check for ALL_SIDES in texture animation

--- src/LookingGlass.Renderer.Ogre/RendererOgreLL.cs
+++ src/LookingGlass.Renderer.Ogre/RendererOgreLL.cs
@@ -513,7 +513,7 @@
             textureParams[pBase + (int)Ogr.CreateMaterialParam.mediaFlags] = textureFace.MediaFlags ? 1f : 0f;

             textureParams[pBase + (int)Ogr.CreateMaterialParam.animationFlag] = 0f;
-            if (prim.TextureAnim.Face == faceNum
+            if ((prim.TextureAnim.Face == faceNum || (int)prim.TextureAnim.Face == -1)
                         && ((prim.TextureAnim.Flags & OpenMetaverse.Primitive.TextureAnimMode.ANIM_ON) != 0)) {
                 m_log.Log(LogLevel.DRENDERDETAIL, "Adding animation for material texture");
                 textureParams[pBase + (int)Ogr.CreateMaterialParam.animationFlag] = (float)prim.TextureAnim.Flags;


csp header on nginx

csp header on nginx

--- util/Setup/NginxConfigBuilder.cs
+++ util/Setup/NginxConfigBuilder.cs
@@ -12,6 +12,10 @@
             "ECDHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA256:DHE-RSA-AES128-SHA256:DHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA:" +
             "ECDHE-RSA-DES-CBC3-SHA:EDH-RSA-DES-CBC3-SHA:AES256-GCM-SHA384:AES128-GCM-SHA256:AES256-SHA256:" +
             "AES128-SHA256:AES256-SHA:AES128-SHA:DES-CBC3-SHA:HIGH:!aNULL:!eNULL:!EXPORT:!DES:!MD5:!PSK:!RC4:@STRENGTH";
+        private const string ContentSecurityPolicy =
+            "default-src 'self'; style-src 'self' 'unsafe-inline'; img-src 'self' data: https://haveibeenpwned.com; " +
+            "child-src 'self' https://*.duosecurity.com; frame-src 'self' https://*.duosecurity.com; " +
+            "connect-src 'self' https://haveibeenpwned.com https://api.pwnedpasswords.com;";

         public NginxConfigBuilder(string domain, string url, bool ssl, bool selfSignedSsl, bool letsEncrypt,
             bool trusted, bool diffieHellman)
@@ -149,7 +153,8 @@
   # This header controls what referrer information is shared
   add_header Referrer-Policy same-origin;

-  # Content-Security-Policy is set via meta tag on the website so it is not included here");
+  # Content-Security-Policy to prevent malicious XSS code
+  add_header Content-Security-Policy {ContentSecurityPolicy}");

                 sw.WriteLine($@"
   location / {{


Simplify

Simplify

--- src/Features/CSharp/Portable/UseExpressionBody/UseExpressionBodyCodeRefactoringProvider.cs
+++ src/Features/CSharp/Portable/UseExpressionBody/UseExpressionBodyCodeRefactoringProvider.cs
@@ -20,7 +20,6 @@
 using Microsoft.CodeAnalysis.CSharp.Syntax;
 using Microsoft.CodeAnalysis.Editing;
 using Microsoft.CodeAnalysis.Formatting;
-using Microsoft.CodeAnalysis.Options;
 using Microsoft.CodeAnalysis.Shared.Extensions;
 using Microsoft.CodeAnalysis.Text;
 using Roslyn.Utilities;
@@ -33,8 +32,8 @@
     {
         private static readonly ImmutableArray<UseExpressionBodyHelper> _helpers = UseExpressionBodyHelper.Helpers;

-        private static readonly BidirectionalMap<(UseExpressionBodyHelper helper, bool useExpressionBody), string> s_helperToEquivalenceKeyMap
-            = CreateHelperToEquivalenceKeyMap(UseExpressionBodyHelper.Helpers);
+        private static readonly ImmutableDictionary<string, (UseExpressionBodyHelper helper, bool useExpressionBody)> s_equivalenceKeyToHelperMap
+            = CreateHelperMap(UseExpressionBodyHelper.Helpers);

         [ImportingConstructor]
         [SuppressMessage("RoslynDiagnosticsReliability", "RS0033:Importing constructor should be [Obsolete]", Justification = "Used in test code: https://github.com/dotnet/roslyn/issues/42814")]
@@ -42,18 +41,18 @@
         {
         }

-        private static BidirectionalMap<(UseExpressionBodyHelper helper, bool useExpressionBody), string> CreateHelperToEquivalenceKeyMap(
+        private static ImmutableDictionary<string, (UseExpressionBodyHelper helper, bool useExpressionBody)> CreateHelperMap(
             ImmutableArray<UseExpressionBodyHelper> helpers)
         {
-            return new BidirectionalMap<(UseExpressionBodyHelper helper, bool useExpressionBody), string>(GetKeyValuePairs(helpers));
-
-            static IEnumerable<KeyValuePair<(UseExpressionBodyHelper helper, bool useExpressionBody), string>> GetKeyValuePairs(
+            return ImmutableDictionary.CreateRange(GetKeyValuePairs(helpers));
+
+            static IEnumerable<KeyValuePair<string, (UseExpressionBodyHelper helper, bool useExpressionBody)>> GetKeyValuePairs(
                 ImmutableArray<UseExpressionBodyHelper> helpers)
             {
                 foreach (var helper in helpers)
                 {
-                    yield return KeyValuePairUtil.Create((helper, useExpressionBody: true), helper.UseExpressionBodyEquivalenceKey);
-                    yield return KeyValuePairUtil.Create((helper, useExpressionBody: false), helper.UseBlockBodyEquivalenceKey);
+                    yield return KeyValuePairUtil.Create(helper.UseExpressionBodyEquivalenceKey, (helper, useExpressionBody: true));
+                    yield return KeyValuePairUtil.Create(helper.UseBlockBodyEquivalenceKey, (helper, useExpressionBody: false));
                 }
             }
         }
@@ -131,7 +130,7 @@
                         c => UpdateDocumentAsync(
                             document, root, declaration, helper,
                             useExpressionBody: true, cancellationToken: c),
-                        s_helperToEquivalenceKeyMap[(helper, useExpressionBody: true)]),
+                        helper.UseExpressionBodyEquivalenceKey),
                     declaration.Span);
                 succeeded = true;
             }
@@ -144,7 +143,7 @@
                         c => UpdateDocumentAsync(
                             document, root, declaration, helper,
                             useExpressionBody: false, cancellationToken: c),
-                        s_helperToEquivalenceKeyMap[(helper, useExpressionBody: false)]),
+                        helper.UseBlockBodyEquivalenceKey),
                     declaration.Span);
                 succeeded = true;
             }
@@ -198,7 +197,7 @@
             CancellationToken cancellationToken)
         {
             Debug.Assert(equivalenceKey != null);
-            var (helper, useExpressionBody) = s_helperToEquivalenceKeyMap[equivalenceKey];
+            var (helper, useExpressionBody) = s_equivalenceKeyToHelperMap[equivalenceKey];

             var root = await document.GetRequiredSyntaxRootAsync(cancellationToken).ConfigureAwait(false);
             var options = (CSharpCodeGenerationOptions)await document.GetCodeGenerationOptionsAsync(optionsProvider, cancellationToken).ConfigureAwait(false);


Lucene.Net.Tests.Index.TestPostingsFormat.TestRandom(): Manually failing test on .NET Standard 1.5 in Debug mode because it crashes the test runner - need to investigate

--- src/Lucene.Net.Tests/Index/TestPostingsFormat.cs
+++ src/Lucene.Net.Tests/Index/TestPostingsFormat.cs
@@ -87,6 +87,12 @@
         [Test]
         public override void TestRandom()
         {
+#if DEBUG
+#if NETSTANDARD1_5
+            fail("LUCENENET TODO: Fatally crashes NUnit");
+#endif
+#endif
+
             base.TestRandom();
         }


Tested report formatting

Tested report formatting

--- src/Manisero.PerformanceMonitor/Manisero.PerformanceMonitor.Tests/ReportFormattingTests.cs
+++ src/Manisero.PerformanceMonitor/Manisero.PerformanceMonitor.Tests/ReportFormattingTests.cs
@@ -1,11 +1,12 @@
-using NUnit.Framework;
+using System;
+using System.Threading;
+using NUnit.Framework;

 namespace Manisero.PerformanceMonitor.Tests
 {
 	public class ReportFormattingTests
 	{
-		[Test]
-		public void formats_default_report()
+		private PerformanceMonitor<string> Execute()
 		{
 			// Arrange
 			var monitor = new PerformanceMonitor<string>();
@@ -15,9 +16,51 @@
 			// Act
 			monitor.StartTask(task1);
 			monitor.StartTask(task2);
+			Thread.Sleep(20);
+			monitor.StopTask(task1);
+			monitor.StopTask(task2);
+
+			return monitor;
+		}
+
+		[Test]
+		public void formats_default_report()
+		{
+			var monitor = Execute();

 			// Assert
 			var report = monitor.GetReport();
+			Console.Write(report);
+		}
+
+		[Test]
+		public void formats_report_without_header()
+		{
+			var monitor = Execute();
+
+			// Assert
+			var report = monitor.GetReport(false);
+			Console.Write(report);
+		}
+
+		[Test]
+		public void formats_report_with_custom_task_name_formatter()
+		{
+			var monitor = Execute();
+
+			// Assert
+			var report = monitor.GetReport(taskNameFormatter: x => x.ToUpper());
+			Console.Write(report);
+		}
+
+		[Test]
+		public void formats_report_with_custom_task_duration_formatter()
+		{
+			var monitor = Execute();
+
+			// Assert
+			var report = monitor.GetReport(taskDurationFormatter: x => x.ToString());
+			Console.Write(report);
 		}
 	}
 }


Fix for issues with paths in spaces

Fix for issues with paths in spaces

1) paths to binaries with spaces didn't work on linux/mac
2) paths to core files with spaces in path didn't work on linux/mac
3) paths to so files with spaces in the path didn't work on linux/mac

Note that in some of these, gdb requires quotes, and on others,
will not accept quotes.

Testing: Verified these scenarios end to end on linux. Verified the
assumptions on mac by manually executing the sceanrios since we don't yet
have a gdb build working on mac.

Bugs: 204605 and 204196

--- src/MIDebugEngine/Engine.Impl/DebuggedProcess.cs
+++ src/MIDebugEngine/Engine.Impl/DebuggedProcess.cs
@@ -491,7 +491,16 @@
             string escappedSearchPath = string.Join(pathEntrySeperator, _launchOptions.GetSOLibSearchPath().Select(path => EscapePath(path, ignoreSpaces: true)));
             if (!string.IsNullOrWhiteSpace(escappedSearchPath))
             {
-                commands.Add(new LaunchCommand("-gdb-set solib-search-path \"" + escappedSearchPath + pathEntrySeperator + "\"", ResourceStrings.SettingSymbolSearchPath));
+                if (!_launchOptions.UseUnixSymbolPaths)
+                {
+                    // surround so lib path with quotes on windows
+                    commands.Add(new LaunchCommand("-gdb-set solib-search-path \"" + escappedSearchPath + pathEntrySeperator + "\"", ResourceStrings.SettingSymbolSearchPath));
+                }
+                else
+                {
+                    // Do not place quotes around so paths on linux/mac. Gdb will ignore the option on these platforms with quotes. Note that spaces do work without them
+                    commands.Add(new LaunchCommand("-gdb-set solib-search-path " + escappedSearchPath + pathEntrySeperator, ResourceStrings.SettingSymbolSearchPath));
+                }
             }

             if (this.MICommandFactory.SupportsStopOnDynamicLibLoad())
@@ -522,8 +531,9 @@
                     // Add executable information
                     this.AddExecutablePathCommand(commands);

-                    // Add core dump information
-                    string coreDumpCommand = String.Concat("-target-select core ", EscapePath(localLaunchOptions.CoreDumpPath));
+                    // Add core dump information (linux/mac does not support quotes around this path but spaces in the path do work)
+                    string coreDump = _launchOptions.UseUnixSymbolPaths ? localLaunchOptions.CoreDumpPath : EscapePath(localLaunchOptions.CoreDumpPath);
+                    string coreDumpCommand = String.Concat("-target-select core ", coreDump);
                     string coreDumpDescription = String.Format(CultureInfo.CurrentCulture, ResourceStrings.LoadingCoreDumpMessage, localLaunchOptions.CoreDumpPath);
                     commands.Add(new LaunchCommand(coreDumpCommand, coreDumpDescription, ignoreFailures: false));
                 }
@@ -776,17 +786,20 @@
         internal string EscapePath(string path, bool ignoreSpaces = false)
         {
             if (_launchOptions.UseUnixSymbolPaths)
-                return path.Replace('\\', '/');
+            {
+                path = path.Replace('\\', '/');
+            }
             else
             {
                 path = path.Trim();
                 path = path.Replace(@"\", @"\\");
-                if (!ignoreSpaces && path.IndexOf(' ') != -1)
-                {
-                    path = '"' + path + '"';
-                }
-                return path;
-            }
+            }
+
+            if (!ignoreSpaces && path.IndexOf(' ') != -1)
+            {
+                path = '"' + path + '"';
+            }
+            return path;
         }

         internal static string UnixPathToWindowsPath(string unixPath)


Convert to IOperation analysis

Convert to IOperation analysis

--- src/NetAnalyzers/CSharp/Microsoft.NetCore.Analyzers/Runtime/LoggerMessageDefineAnalyzer.cs
+++ src/NetAnalyzers/CSharp/Microsoft.NetCore.Analyzers/Runtime/LoggerMessageDefineAnalyzer.cs
@@ -3,12 +3,10 @@
 using System;
 using System.Collections.Immutable;
 using System.Linq;
-using System.Threading;
 using Analyzer.Utilities;
 using Microsoft.CodeAnalysis;
-using Microsoft.CodeAnalysis.CSharp;
-using Microsoft.CodeAnalysis.CSharp.Syntax;
 using Microsoft.CodeAnalysis.Diagnostics;
+using Microsoft.CodeAnalysis.Operations;
 using Microsoft.CodeQuality.Analyzers;
 using Microsoft.Extensions.Logging;

@@ -114,60 +112,54 @@
                     return;
                 }

-                context.RegisterSyntaxNodeAction(context => AnalyzeInvocation(context, loggerType, loggerExtensionsType, loggerMessageType), SyntaxKind.InvocationExpression);
+                context.RegisterOperationAction(context => AnalyzeInvocation(context, loggerType, loggerExtensionsType, loggerMessageType), OperationKind.Invocation);
             });
         }

-        private void AnalyzeInvocation(SyntaxNodeAnalysisContext syntaxContext, INamedTypeSymbol loggerType, INamedTypeSymbol loggerExtensionsType, INamedTypeSymbol loggerMessageType)
-        {
-            var invocation = (InvocationExpressionSyntax)syntaxContext.Node;
-
-            var symbolInfo = ModelExtensions.GetSymbolInfo(syntaxContext.SemanticModel, invocation, syntaxContext.CancellationToken);
-            if (symbolInfo.Symbol?.Kind != SymbolKind.Method)
+        private void AnalyzeInvocation(OperationAnalysisContext context, INamedTypeSymbol loggerType, INamedTypeSymbol loggerExtensionsType, INamedTypeSymbol loggerMessageType)
+        {
+            var invocation = (IInvocationOperation)context.Operation;
+
+            var methodSymbol = invocation.TargetMethod;
+
+            if (methodSymbol.ContainingType == loggerExtensionsType)
+            {
+                context.ReportDiagnostic(Diagnostic.Create(CA1848Rule, invocation.Syntax.GetLocation(), methodSymbol.Name));
+            }
+            else if (!methodSymbol.ContainingType.Equals(loggerType) && !methodSymbol.ContainingType.Equals(loggerMessageType))
             {
                 return;
             }

-            var methodSymbol = (IMethodSymbol)symbolInfo.Symbol;
-
-            if (methodSymbol.ContainingType == loggerExtensionsType)
-            {
-                syntaxContext.ReportDiagnostic(Diagnostic.Create(CA1848Rule, invocation.GetLocation(), methodSymbol.Name));
-            }
-            else if (!methodSymbol.ContainingType.Equals(loggerType) && !methodSymbol.ContainingType.Equals(loggerMessageType))
-            {
-                return;
-            }
-
             if (FindLogParameters(methodSymbol, out var messageArgument, out var paramsArgument))
             {
                 int paramsCount = 0;
-                ExpressionSyntax? formatExpression = null;
+                IOperation? formatExpression = null;
                 bool argsIsArray = false;

                 if (methodSymbol.ContainingType == loggerMessageType)
                 {
                     // For LoggerMessage.Define, count type parameters on the invocation instead of arguments
                     paramsCount = methodSymbol.TypeParameters.Length;
-                    var arg = invocation.ArgumentList.Arguments.FirstOrDefault(argument =>
-                    {
-                        var parameter = DetermineParameter(argument, syntaxContext.SemanticModel, syntaxContext.CancellationToken);
+                    var arg = invocation.Arguments.FirstOrDefault(argument =>
+                    {
+                        var parameter = argument.Parameter;
                         return Equals(parameter, messageArgument);
                     });
-                    formatExpression = arg.Expression;
+                    formatExpression = arg.Value;
                 }
                 else
                 {
-                    foreach (var argument in invocation.ArgumentList.Arguments)
-                    {
-                        var parameter = DetermineParameter(argument, syntaxContext.SemanticModel, syntaxContext.CancellationToken);
+                    foreach (var argument in invocation.Arguments)
+                    {
+                        var parameter = argument.Parameter;
                         if (Equals(parameter, messageArgument))
                         {
-                            formatExpression = argument.Expression;
+                            formatExpression = argument.Value;
                         }
                         else if (Equals(parameter, paramsArgument))
                         {
-                            var parameterType = syntaxContext.SemanticModel.GetTypeInfo(argument.Expression).ConvertedType;
+                            var parameterType = argument.Parameter.Type;// TODO test
                             if (parameterType == null)
                             {
                                 return;
@@ -183,17 +175,17 @@

                 if (formatExpression is not null)
                 {
-                    AnalyzeFormatArgument(syntaxContext, formatExpression, paramsCount, argsIsArray);
-                }
-            }
-        }
-
-        private void AnalyzeFormatArgument(SyntaxNodeAnalysisContext syntaxContext, ExpressionSyntax formatExpression, int paramsCount, bool argsIsArray)
-        {
-            var text = TryGetFormatText(formatExpression, syntaxContext.SemanticModel);
+                    AnalyzeFormatArgument(context, formatExpression, paramsCount, argsIsArray);
+                }
+            }
+        }
+
+        private void AnalyzeFormatArgument(OperationAnalysisContext context, IOperation formatExpression, int paramsCount, bool argsIsArray)
+        {
+            var text = TryGetFormatText(formatExpression);
             if (text == null)
             {
-                syntaxContext.ReportDiagnostic(Diagnostic.Create(CA2254Rule, formatExpression.GetLocation()));
+                context.ReportDiagnostic(Diagnostic.Create(CA2254Rule, formatExpression.Syntax.GetLocation()));
                 return;
             }

@@ -213,37 +205,37 @@
             {
                 if (int.TryParse(valueName, out _))
                 {
-                    syntaxContext.ReportDiagnostic(Diagnostic.Create(CA2253Rule, formatExpression.GetLocation()));
+                    context.ReportDiagnostic(Diagnostic.Create(CA2253Rule, formatExpression.Syntax.GetLocation()));
                 }
                 else if (char.IsLower(valueName[0]))
                 {
-                    syntaxContext.ReportDiagnostic(Diagnostic.Create(CA1727Rule, formatExpression.GetLocation()));
+                    context.ReportDiagnostic(Diagnostic.Create(CA1727Rule, formatExpression.Syntax.GetLocation()));
                 }
             }

             var argsPassedDirectly = argsIsArray && paramsCount == 1;
             if (!argsPassedDirectly && paramsCount != formatter.ValueNames.Count)
             {
-                syntaxContext.ReportDiagnostic(Diagnostic.Create(CA2255Rule, formatExpression.GetLocation()));
-            }
-        }
-
-        private string? TryGetFormatText(ExpressionSyntax? argumentExpression, SemanticModel semanticModel)
+                context.ReportDiagnostic(Diagnostic.Create(CA2255Rule, formatExpression.Syntax.GetLocation()));
+            }
+        }
+
+        private string? TryGetFormatText(IOperation? argumentExpression)
         {
             if (argumentExpression is null)
                 return null;

             switch (argumentExpression)
             {
-                case LiteralExpressionSyntax literal when literal.Token.IsKind(SyntaxKind.StringLiteralToken):
-                    return literal.Token.ValueText;
-                case InterpolatedStringExpressionSyntax interpolated:
+                case ILiteralOperation { ConstantValue: { HasValue: true, Value: string constantValue } }:
+                    return constantValue;
+                case IInterpolatedStringOperation interpolated:
                     var text = "";
-                    foreach (var interpolatedStringContentSyntax in interpolated.Contents)
-                    {
-                        if (interpolatedStringContentSyntax is InterpolatedStringTextSyntax textSyntax)
+                    foreach (var interpolatedStringContent in interpolated.Parts)
+                    {
+                        if (interpolatedStringContent is IInterpolatedStringTextOperation textSyntax)
                         {
-                            text += textSyntax.TextToken.ValueText;
+                            text += textSyntax.Text;
                         }
                         else
                         {
@@ -251,14 +243,14 @@
                         }
                     }
                     return text;
-                case InvocationExpressionSyntax invocation when IsNameOfInvocation(invocation):
+                case INameOfOperation:
                     // return placeholder from here because actual value is not required for analysis and is hard to get
                     return "NAMEOF";
-                case ParenthesizedExpressionSyntax parenthesized:
-                    return TryGetFormatText(parenthesized.Expression, semanticModel);
-                case BinaryExpressionSyntax binary when binary.OperatorToken.IsKind(SyntaxKind.PlusToken):
-                    var leftText = TryGetFormatText(binary.Left, semanticModel);
-                    var rightText = TryGetFormatText(binary.Right, semanticModel);
+                case IParenthesizedOperation parenthesized:
+                    return TryGetFormatText(parenthesized.Operand);
+                case IBinaryOperation { OperatorKind: BinaryOperatorKind.Add } binary:
+                    var leftText = TryGetFormatText(binary.LeftOperand);
+                    var rightText = TryGetFormatText(binary.RightOperand);

                     if (leftText != null && rightText != null)
                     {
@@ -267,7 +259,7 @@

                     return null;
                 default:
-                    var constant = semanticModel.GetConstantValue(argumentExpression);
+                    var constant = argumentExpression.ConstantValue;
                     if (constant.HasValue && constant.Value is string constantString)
                     {
                         return constantString;
@@ -306,67 +298,5 @@
             }
             return message != null;
         }
-
-        private static bool IsNameOfInvocation(InvocationExpressionSyntax invocation)
-        {
-            return invocation.Expression is IdentifierNameSyntax identifierName &&
-                   (identifierName.Identifier.IsKind(SyntaxKind.NameOfKeyword) ||
-                   identifierName.Identifier.ToString() == SyntaxFacts.GetText(SyntaxKind.NameOfKeyword));
-        }
-
-        private static IParameterSymbol? DetermineParameter(
-            ArgumentSyntax argument,
-            SemanticModel semanticModel,
-            CancellationToken cancellationToken)
-        {
-            if (argument.Parent is not BaseArgumentListSyntax argumentList)
-            {
-                return null;
-            }
-
-            if (argumentList.Parent is not ExpressionSyntax invocableExpression)
-            {
-                return null;
-            }
-
-            if (semanticModel.GetSymbolInfo(invocableExpression, cancellationToken).Symbol is not IMethodSymbol symbol)
-            {
-                return null;
-            }
-
-            var parameters = symbol.Parameters;
-
-            // Handle named argument
-            if (argument.NameColon != null && !argument.NameColon.IsMissing)
-            {
-                var name = argument.NameColon.Name.Identifier.ValueText;
-                return parameters.FirstOrDefault(p => p.Name == name);
-            }
-
-            // Handle positional argument
-            var index = argumentList.Arguments.IndexOf(argument);
-            if (index < 0)
-            {
-                return null;
-            }
-
-            if (index < parameters.Length)
-            {
-                return parameters[index];
-            }
-
-            var lastParameter = parameters.LastOrDefault();
-            if (lastParameter == null)
-            {
-                return null;
-            }
-
-            if (lastParameter.IsParams)
-            {
-                return lastParameter;
-            }
-
-            return null;
-        }
     }
 }


Test on null input string

Test on null input string

--- src/MK.Lib.T/Ext/StringExt__AppendRandom_Test.cs
+++ src/MK.Lib.T/Ext/StringExt__AppendRandom_Test.cs
@@ -44,6 +44,16 @@
 		}

 		[Test]
+		[TestCase(null, 8)]
+		[TestCase("", 40)]
+		public void WorksOnNullAndEmptyStrings(string s, int len)
+		{
+			var e = StringExt.AppendRandom(s, len);
+			Assert.That(e, Is.Not.Null);
+			Assert.That(e, Has.Length.EqualTo(len));
+		}
+
+		[Test]
 		public void NotThrowOnNullDomain()
 		{
 			Assert.DoesNotThrow(() =>


Code cleanup.

Code cleanup.

--- src/Magick.NET/Shared/Settings/MagickSettings.cs
+++ src/Magick.NET/Shared/Settings/MagickSettings.cs
@@ -539,9 +539,7 @@
         /// <param name="name">The name of the define.</param>
         /// <param name="flag">The value of the define.</param>
         public void SetDefine(MagickFormat format, string name, bool flag)
-        {
-            SetDefine(format, name, flag ? "true" : "false");
-        }
+            => SetDefine(format, name, flag ? "true" : "false");

         /// <summary>
         /// Sets a format-specific option.
@@ -603,7 +601,8 @@
             return null;
         }

-        internal void SetOption(string key, string value) => _options[key] = value;
+        internal void SetOption(string key, string value)
+            => _options[key] = value;

         /// <summary>
         /// Creates a define string for the specified format and name.


PubMany tests

PubMany tests

--- src/MyNatsClient.IntegrationTests/PubSubTests.cs
+++ src/MyNatsClient.IntegrationTests/PubSubTests.cs
@@ -56,6 +56,7 @@
         [Timeout(MaxTimeMs)]
         public async Task A_published_message_Should_be_published_and_consumed_in_full()
         {
+            var interceptCount = 0;
             var intercepted = new List<MsgOp>();
             var messages = new[]
             {
@@ -64,22 +65,56 @@
                 "My async test string\r\nwith two lines and\ttabs!",
                 "Async Foo bar!"
             };
+            _client1.MsgOpStream.Subscribe(msg =>
+            {
+                intercepted.Add(msg);
+                var x = Interlocked.Increment(ref interceptCount);
+                if (x == messages.Length)
+                    Sync.Set();
+            });
             _client1.Sub("Test", "s1");
+
+            _client1.Pub("Test", messages[0]);
+            _client1.Pub("Test", Encoding.UTF8.GetBytes(messages[1]));
+            await _client1.PubAsync("Test", messages[2]);
+            await _client1.PubAsync("Test", Encoding.UTF8.GetBytes(messages[3]));
+
+            Sync.WaitOne();
+            intercepted.Should().HaveCount(messages.Length);
+            intercepted.Select(m => m.GetPayloadAsString()).ToArray().Should().Contain(messages);
+        }
+
+        [Test]
+        [Timeout(MaxTimeMs)]
+        public void A_published_message_using_PubMany_Should_be_published_and_consumed_in_full()
+        {
+            var interceptCount = 0;
+            var intercepted = new List<MsgOp>();
+            var messages = new[]
+            {
+                "My test string\r\nwith two lines and\ttabs!",
+                "Foo bar!",
+                "My async test string\r\nwith two lines and\ttabs!",
+                "Async Foo bar!"
+            };
             _client1.MsgOpStream.Subscribe(msg =>
             {
                 intercepted.Add(msg);
-                Sync.Set();
-            });
-
-            _client1.Pub("Test", messages[0]);
-            Sync.WaitOne();
-            _client1.Pub("Test", Encoding.UTF8.GetBytes(messages[1]));
-            Sync.WaitOne();
-            await _client1.PubAsync("Test", messages[2]);
-            Sync.WaitOne();
-            await _client1.PubAsync("Test", Encoding.UTF8.GetBytes(messages[3]));
-            Sync.WaitOne();
-
+                var x = Interlocked.Increment(ref interceptCount);
+                if (x == messages.Length)
+                    Sync.Set();
+            });
+            _client1.Sub("Test", "s1");
+
+            _client1.PubMany(async p =>
+            {
+                p.Pub("Test", messages[0]);
+                p.Pub("Test", Encoding.UTF8.GetBytes(messages[1]));
+                await p.PubAsync("Test", messages[2]);
+                await p.PubAsync("Test", Encoding.UTF8.GetBytes(messages[3]));
+            });
+
+            Sync.WaitOne();
             intercepted.Should().HaveCount(messages.Length);
             intercepted.Select(m => m.GetPayloadAsString()).ToArray().Should().Contain(messages);
         }


Make AppDomainWrapper internal (#3457)

Make AppDomainWrapper internal (#3457)

--- src/NLog/Internal/AppDomains/AppDomainWrapper.cs
+++ src/NLog/Internal/AppDomains/AppDomainWrapper.cs
@@ -43,7 +43,7 @@
     /// <summary>
     /// Adapter for <see cref="AppDomain"/> to <see cref="IAppDomain"/>
     /// </summary>
-    public class AppDomainWrapper : IAppDomain
+    internal class AppDomainWrapper : IAppDomain
     {
 #if !SILVERLIGHT
         private readonly AppDomain _currentAppDomain;


Forgot group attribute

Forgot group attribute

--- src/NadekoBot/Modules/Utility/Commands/Remind.cs
+++ src/NadekoBot/Modules/Utility/Commands/Remind.cs
@@ -16,6 +16,7 @@
 {
     public partial class Utility
     {
+        [Group]
         public class RemindCommands
         {


Reminder fixed

Reminder fixed

--- src/NadekoBot/Modules/Utility/Commands/Remind.cs
+++ src/NadekoBot/Modules/Utility/Commands/Remind.cs
@@ -48,10 +48,8 @@
             {
                 var now = DateTime.Now;
                 var twoMins = new TimeSpan(0, 2, 0);
-                TimeSpan time = (r.When - now) < twoMins
-                                ? twoMins       //if the time is less than 2 minutes,
-                                : r.When - now; //it will send the message 2 minutes after start
-                                                //To account for high bot startup times
+                TimeSpan time = r.When - now;
+
                 if (time.TotalMilliseconds > int.MaxValue)
                     return;

@@ -180,9 +178,11 @@
                 using (var uow = DbHandler.UnitOfWork())
                 {
                     uow.Reminders.Add(rem);
+                    await uow.CompleteAsync();
                 }

                 await channel.SendMessageAsync($"⏰ I will remind \"{(ch is ITextChannel ? ((ITextChannel)ch).Name : imsg.Author.Username)}\" to \"{message.ToString()}\" in {output}. ({time:d.M.yyyy.} at {time:HH:mm})").ConfigureAwait(false);
+                await StartReminder(rem);
             }

             ////todo owner only


razor views are associated with .cshtml instead of .razor

--- src/Nancy.ViewEngines.Razor/RazorViewRegistry.cs
+++ src/Nancy.ViewEngines.Razor/RazorViewRegistry.cs
@@ -7,7 +7,7 @@
     {
         public string Extension
         {
-            get { return ".razor"; }
+            get { return ".cshtml"; }
         }

         public Func<string, object, Action<Stream>> Executor