Changes on SerializedObject

Changes on SerializedObject

--- src/TWCore/Serialization/SerializedObject.cs
+++ src/TWCore/Serialization/SerializedObject.cs
@@ -19,6 +19,7 @@
 using System.Runtime.CompilerServices;
 using System.Runtime.Serialization;
 using System.Text;
+using System.Threading.Tasks;
 using System.Xml.Serialization;
 using TWCore.Compression;

@@ -46,16 +47,32 @@
         #endregion

         #region .ctor
-        public SerializedObject() { }
-        public SerializedObject(object data) : this(data, SerializerManager.DefaultBinarySerializer) { }
+
+        public SerializedObject()
+        {
+        }
+
+        public SerializedObject(object data) : this(data, SerializerManager.DefaultBinarySerializer)
+        {
+        }
+
         public SerializedObject(object data, ISerializer serializer)
         {
             if (data == null) return;
             var type = data.GetType();
             DataType = type.GetTypeName();
-            SerializerMimeType = serializer.MimeTypes[0] + ((serializer.Compressor != null) ? ":" + serializer.Compressor.EncodingType : string.Empty);
-            Data = (byte[])serializer.Serialize(data, type);
-        }
+            if (data is byte[] bytes)
+            {
+                SerializerMimeType = null;
+                Data = bytes;
+            }
+            else
+            {
+                SerializerMimeType = serializer.MimeTypes[0] + ((serializer.Compressor != null) ? ":" + serializer.Compressor.EncodingType : string.Empty);
+                Data = (byte[]) serializer.Serialize(data, type);
+            }
+        }
+
         #endregion

         #region Methods
@@ -66,76 +83,242 @@
         [MethodImpl(MethodImplOptions.AggressiveInlining)]
         public object GetValue()
         {
-            if (Data == null || Data.Length == 0) return null;
+            if (Data == null) return null;
             var type = string.IsNullOrWhiteSpace(DataType) ? typeof(object) : Core.GetType(DataType, true);
-            ISerializer serializer;
-            if (string.IsNullOrWhiteSpace(SerializerMimeType))
-                serializer = SerializerManager.DefaultBinarySerializer;
-            else
-            {
-                var idx = SerializerMimeType.IndexOf(':');
-                var serMime = idx < 0 ? SerializerMimeType : SerializerMimeType.Substring(0, idx);
-                var serComp = idx < 0 ? null : SerializerMimeType.Substring(idx + 1);
-                serializer = SerializerManager.GetByMimeType(serMime);
-                if (!string.IsNullOrWhiteSpace(serComp))
-                    serializer.Compressor = CompressorManager.GetByEncodingType(serComp);
-            }
+            if (string.IsNullOrWhiteSpace(SerializerMimeType))
+                return type == typeof(byte[]) ? Data : null;
+            var idx = SerializerMimeType.IndexOf(':');
+            var serMime = idx < 0 ? SerializerMimeType : SerializerMimeType.Substring(0, idx);
+            var serComp = idx < 0 ? null : SerializerMimeType.Substring(idx + 1);
+            var serializer = SerializerManager.GetByMimeType(serMime);
+            if (!string.IsNullOrWhiteSpace(serComp))
+                serializer.Compressor = CompressorManager.GetByEncodingType(serComp);
             return serializer.Deserialize(Data, type);
         }
         /// <summary>
         /// Get SubArray representation of the SerializedObject instance
         /// </summary>
         /// <returns>SubArray instance</returns>
+        [MethodImpl(MethodImplOptions.AggressiveInlining)]
         public SubArray<byte> ToSubArray()
         {
-            var dataTypeByte = Encoding.UTF8.GetBytes(DataType ?? string.Empty);
-            var serializerMimeTypeByte = Encoding.UTF8.GetBytes(SerializerMimeType ?? string.Empty);
-            var dataByte = Data ?? new byte[0];
-            var ms = new MemoryStream();
-            var bw = new BinaryWriter(ms);
-            bw.Write(dataTypeByte.Length);
-            bw.Write(dataTypeByte);
-            bw.Write(serializerMimeTypeByte.Length);
-            bw.Write(serializerMimeTypeByte);
-            bw.Write(dataByte.Length);
-            bw.Write(dataByte);
-            return ms.ToSubArray();
-        }
+            var dataTypeByte = !string.IsNullOrEmpty(DataType) ? Encoding.UTF8.GetBytes(DataType) : null;
+            var serializerMimeTypeByte = !string.IsNullOrEmpty(SerializerMimeType) ? Encoding.UTF8.GetBytes(SerializerMimeType) : null;
+            using (var ms = new MemoryStream())
+            using (var bw = new BinaryWriter(ms))
+            {
+                bw.Write(dataTypeByte?.Length ?? -1);
+                if (dataTypeByte != null) bw.Write(dataTypeByte);
+                bw.Write(serializerMimeTypeByte?.Length ?? -1);
+                if (serializerMimeTypeByte != null) bw.Write(serializerMimeTypeByte);
+                bw.Write(Data?.Length ?? -1);
+                if (Data != null) bw.Write(Data);
+                return ms.ToSubArray();
+            }
+        }
+        /// <summary>
+        /// Get SubArray representation of the SerializedObject instance
+        /// </summary>
+        /// <returns>SubArray instance</returns>
+        [MethodImpl(MethodImplOptions.AggressiveInlining)]
+        public void WriteTo(Stream stream)
+        {
+            var dataTypeByte = !string.IsNullOrEmpty(DataType) ? Encoding.UTF8.GetBytes(DataType) : null;
+            var serializerMimeTypeByte = !string.IsNullOrEmpty(SerializerMimeType) ? Encoding.UTF8.GetBytes(SerializerMimeType) : null;
+            using (var bw = new BinaryWriter(stream, Encoding.UTF8, true))
+            {
+                bw.Write(dataTypeByte?.Length ?? -1);
+                if (dataTypeByte != null) bw.Write(dataTypeByte);
+                bw.Write(serializerMimeTypeByte?.Length ?? -1);
+                if (serializerMimeTypeByte != null) bw.Write(serializerMimeTypeByte);
+                bw.Write(Data?.Length ?? -1);
+                if (Data != null) bw.Write(Data);
+            }
+        }
+        /// <summary>
+        /// Writes the SerializedObject to a binary writer
+        /// </summary>
+        [MethodImpl(MethodImplOptions.AggressiveInlining)]
+        public void WriteTo(BinaryWriter bw)
+        {
+            var dataTypeByte = !string.IsNullOrEmpty(DataType) ? Encoding.UTF8.GetBytes(DataType) : null;
+            var serializerMimeTypeByte = !string.IsNullOrEmpty(SerializerMimeType) ? Encoding.UTF8.GetBytes(SerializerMimeType) : null;
+            bw.Write(dataTypeByte?.Length ?? -1);
+            if (dataTypeByte != null) bw.Write(dataTypeByte);
+            bw.Write(serializerMimeTypeByte?.Length ?? -1);
+            if (serializerMimeTypeByte != null) bw.Write(serializerMimeTypeByte);
+            bw.Write(Data?.Length ?? -1);
+            if (Data != null) bw.Write(Data);
+        }
+        /// <summary>
+        /// Write the SerializedObject to a file
+        /// </summary>
+        /// <param name="filepath">Filepath to save the serialized object instance</param>
+        /// <returns>Awaitable task instance</returns>
+        [MethodImpl(MethodImplOptions.AggressiveInlining)]
+        public async Task ToFileAsync(string filepath)
+        {
+            var dataTypeByte = !string.IsNullOrEmpty(DataType) ? Encoding.UTF8.GetBytes(DataType) : null;
+            var serializerMimeTypeByte = !string.IsNullOrEmpty(SerializerMimeType) ? Encoding.UTF8.GetBytes(SerializerMimeType) : null;
+            using (var fs = new FileStream(filepath, FileMode.Create, FileAccess.Write, FileShare.Read))
+            {
+                await fs.WriteBytesAsync(BitConverter.GetBytes(dataTypeByte?.Length ?? -1), false).ConfigureAwait(false);
+                if (dataTypeByte != null)
+                    await fs.WriteBytesAsync(dataTypeByte, false).ConfigureAwait(false);
+                await fs.WriteBytesAsync(BitConverter.GetBytes(serializerMimeTypeByte?.Length ?? -1), false).ConfigureAwait(false);
+                if (serializerMimeTypeByte != null)
+                    await fs.WriteBytesAsync(serializerMimeTypeByte, false).ConfigureAwait(false);
+                await fs.WriteBytesAsync(BitConverter.GetBytes(Data?.Length ?? -1), false).ConfigureAwait(false);
+                if (Data != null)
+                    await fs.WriteBytesAsync(Data).ConfigureAwait(false);
+            }
+        }
+
         /// <summary>
         /// Get SerializedObject instance from the SubArray representation.
         /// </summary>
         /// <param name="byteArray">SubArray instance</param>
         /// <returns>SerializedObject instance</returns>
+        [MethodImpl(MethodImplOptions.AggressiveInlining)]
         public static SerializedObject FromSubArray(SubArray<byte> byteArray)
         {
-            var ms = byteArray.ToMemoryStream();
-            var br = new BinaryReader(ms);
-            var rByte = byteArray.Count;
-
+            using(var ms = byteArray.ToMemoryStream())
+            using (var br = new BinaryReader(ms))
+            {
+                var rByte = byteArray.Count;
+
+                var dataTypeByteLength = br.ReadInt32();
+                if (dataTypeByteLength < -1 || dataTypeByteLength > rByte) return null;
+                var dataTypeByte = dataTypeByteLength != -1 ? br.ReadBytes(dataTypeByteLength) : null;
+                rByte -= dataTypeByteLength;
+
+                var serializerMimeTypeByteLength = br.ReadInt32();
+                if (serializerMimeTypeByteLength < -1 || serializerMimeTypeByteLength > rByte) return null;
+                var serializerMimeTypeByte = serializerMimeTypeByteLength != -1 ? br.ReadBytes(serializerMimeTypeByteLength) : null;
+                rByte -= serializerMimeTypeByteLength;
+
+                var dataLength = br.ReadInt32();
+                if (dataLength < -1 || dataLength > rByte) return null;
+                var data = dataLength != -1 ? br.ReadBytes(dataLength) : null;
+
+                return new SerializedObject
+                {
+                    DataType = dataTypeByte != null ? Encoding.UTF8.GetString(dataTypeByte) : null,
+                    SerializerMimeType = serializerMimeTypeByte != null ? Encoding.UTF8.GetString(serializerMimeTypeByte) : null,
+                    Data = data
+                };
+            }
+        }
+        /// <summary>
+        /// Get SerializedObject instance from a stream
+        /// </summary>
+        /// <param name="stream">Source stream</param>
+        /// <returns>SerializedObject instance</returns>
+        [MethodImpl(MethodImplOptions.AggressiveInlining)]
+        public static SerializedObject FromStream(Stream stream)
+        {
+            using (var br = new BinaryReader(stream, Encoding.UTF8, true))
+            {
+                var dataTypeByteLength = br.ReadInt32();
+                if (dataTypeByteLength < -1) return null;
+                var dataTypeByte = dataTypeByteLength != -1 ? br.ReadBytes(dataTypeByteLength) : null;
+
+                var serializerMimeTypeByteLength = br.ReadInt32();
+                if (serializerMimeTypeByteLength < -1) return null;
+                var serializerMimeTypeByte = serializerMimeTypeByteLength != -1 ? br.ReadBytes(serializerMimeTypeByteLength) : null;
+
+                var dataLength = br.ReadInt32();
+                if (dataLength < -1) return null;
+                var data = dataLength != -1 ? br.ReadBytes(dataLength) : null;
+
+                return new SerializedObject
+                {
+                    DataType = dataTypeByte != null ? Encoding.UTF8.GetString(dataTypeByte) : null,
+                    SerializerMimeType = serializerMimeTypeByte != null ? Encoding.UTF8.GetString(serializerMimeTypeByte) : null,
+                    Data = data
+                };
+            }
+        }
+        /// <summary>
+        /// Get SerializedObject instance from a BinaryReader
+        /// </summary>
+        /// <param name="br">BinaryReader instance</param>
+        /// <returns>SerializedObject instance</returns>
+        [MethodImpl(MethodImplOptions.AggressiveInlining)]
+        public static SerializedObject FromStream(BinaryReader br)
+        {
             var dataTypeByteLength = br.ReadInt32();
-            if (dataTypeByteLength < 0) return null;
-            if (dataTypeByteLength > byteArray.Count) return null;
-            var dataTypeByte = br.ReadBytes(dataTypeByteLength);
-            rByte -= dataTypeByteLength;
+            if (dataTypeByteLength < -1) return null;
+            var dataTypeByte = dataTypeByteLength != -1 ? br.ReadBytes(dataTypeByteLength) : null;

             var serializerMimeTypeByteLength = br.ReadInt32();
-            if (serializerMimeTypeByteLength < 0) return null;
-            if (serializerMimeTypeByteLength > rByte) return null;
-            var serializerMimeTypeByte = br.ReadBytes(serializerMimeTypeByteLength);
-            rByte -= serializerMimeTypeByteLength;
-
-            var dataByteLength = br.ReadInt32();
-            if (dataByteLength < 0) return null;
-            if (dataByteLength > rByte) return null;
-            var dataByte = br.ReadBytes(dataByteLength);
+            if (serializerMimeTypeByteLength < -1) return null;
+            var serializerMimeTypeByte = serializerMimeTypeByteLength != -1 ? br.ReadBytes(serializerMimeTypeByteLength) : null;
+
+            var dataLength = br.ReadInt32();
+            if (dataLength < -1) return null;
+            var data = dataLength != -1 ? br.ReadBytes(dataLength) : null;

             return new SerializedObject
             {
-                DataType = Encoding.UTF8.GetString(dataTypeByte),
-                SerializerMimeType = Encoding.UTF8.GetString(serializerMimeTypeByte),
-                Data = dataByte
+                DataType = dataTypeByte != null ? Encoding.UTF8.GetString(dataTypeByte) : null,
+                SerializerMimeType = serializerMimeTypeByte != null ? Encoding.UTF8.GetString(serializerMimeTypeByte) : null,
+                Data = data
             };
+        }
+        /// <summary>
+        /// Read the SerializedObject from a file
+        /// </summary>
+        /// <param name="filepath">Filepath to load the serialized object instance</param>
+        /// <returns>Awaitable task instance</returns>
+        [MethodImpl(MethodImplOptions.AggressiveInlining)]
+        public static async Task<SerializedObject> FromFileAsync(string filepath)
+        {
+            using (var fs = new FileStream(filepath, FileMode.Open, FileAccess.Read, FileShare.Read))
+            {
+                var length = fs.Length;
+                var bInt = new byte[4];
+
+                await fs.ReadAsync(bInt, 0, 4).ConfigureAwait(false);
+                var dtLength = BitConverter.ToInt32(bInt, 0);
+                if (dtLength < -1 || dtLength > length) return null;
+                byte[] dataTypeByte = null;
+                if (dtLength != -1)
+                {
+                    dataTypeByte = new byte[dtLength];
+                    await fs.ReadAsync(dataTypeByte, 0, dtLength).ConfigureAwait(false);
+                    length -= dtLength;
+                }
+
+                await fs.ReadAsync(bInt, 0, 4).ConfigureAwait(false);
+                var smtLength = BitConverter.ToInt32(bInt, 0);
+                if (smtLength < -1 || smtLength > length) return null;
+                byte[] serializerMimeTypeByte = null;
+                if (smtLength != -1)
+                {
+                    serializerMimeTypeByte = new byte[smtLength];
+                    await fs.ReadAsync(serializerMimeTypeByte, 0, smtLength).ConfigureAwait(false);
+                    length -= smtLength;
+                }
+
+                await fs.ReadAsync(bInt, 0, 4).ConfigureAwait(false);
+                var dataLength = BitConverter.ToInt32(bInt, 0);
+                if (dataLength < -1 || dataLength > length) return null;
+                byte[] data = null;
+                if (dataLength != -1)
+                {
+                    data = new byte[dataLength];
+                    await fs.ReadAsync(data, 0, dataLength).ConfigureAwait(false);
+                }
+
+                return new SerializedObject
+                {
+                    DataType = dataTypeByte != null ? Encoding.UTF8.GetString(dataTypeByte) : null,
+                    SerializerMimeType = serializerMimeTypeByte != null ? Encoding.UTF8.GetString(serializerMimeTypeByte) : null,
+                    Data = data
+                };
+            }
         }
         #endregion
     }
-}
+}


#823 Update TODO comments

#823 Update TODO comments

--- src/Titanium.Web.Proxy/Helpers/HttpStream.cs
+++ src/Titanium.Web.Proxy/Helpers/HttpStream.cs
@@ -1085,12 +1085,12 @@
             var originalIsChunked = isRequest ? args.HttpClient.Request.OriginalIsChunked : args.HttpClient.Response.OriginalIsChunked;

             //1. Begin while(true) loop
-            //2. Read bytes from original stream (max length of bytes will be equal to bufferPool.BufferSize).
-            //3. Call BeforeBodyWrite event handler with BeforeBodyWriteEventArgs.BodyBytes set to the bytes read from original stream.
+            //2. Parse chunk if chunked, and read bytes from original stream. Max length of bytes read will be equal to bufferPool.BufferSize.
+            //3. Call BeforeBodyWrite event handler with BeforeBodyWriteEventArgs.BodyBytes set to the bytes read from original stream (pass null if original stream reached its end).
             //4. Write BeforeBodyWriteEventArgs.BodyBytes to the target stream when BeforeBodyWriteEventArgs.BodyBytes is not null or empty.
             //5. Stop writing to target stream when 'long contentLength' parameter number of bytes are written (when not chunked) or
             //when BeforeBodyWriteEventArgs.IsLastChunk is true after callback (when chunked).
-            //6. Exit loop when original stream is completely siphoned out and when writing in step 5 has stopped.
+            //6. Exit loop when original stream reaches its end AND when writing in step 5 has stopped.
             throw new NotImplementedException();
         }


fixes to match controller

fixes to match controller

--- src/TournamentTracker/Api/MatchController.cs
+++ src/TournamentTracker/Api/MatchController.cs
@@ -7,7 +7,7 @@

 namespace TournamentTracker.Api
 {
-    public class MatchController
+    public class MatchController : Controller
     {
         private IMatchService _matchService;
         private IApplicationUserService _applicationUserService;
@@ -23,6 +23,7 @@
         public MatchModel Get(int id)
         {
             var match = _matchService.GetMatchById(id);
+            if (match == null) return null;
             var matchModel = new MatchModel()
             {
                 Id = match.Id,
@@ -34,8 +35,9 @@
             return matchModel;
         }

+        [Route("api/[controller]")]
         [HttpPost]
-        public void Post(MatchModel model)
+        public void Post([FromBody]MatchModel model)
         {
             var match = new Match()
             {


No allowed doctype validation in copy/paste operations, as it complicates workflow

--- src/Umbraco.Web/Editors/ContentController.cs
+++ src/Umbraco.Web/Editors/ContentController.cs
@@ -1,15 +1,15 @@
-using System;
+using AutoMapper;
+using System;
 using System.Collections.Generic;
 using System.Globalization;
 using System.Linq;
 using System.Net;
 using System.Net.Http;
-using System.Net.Http.Formatting;
 using System.Text;
 using System.Web.Http;
 using System.Web.Http.ModelBinding;
-using System.Web.Http.ModelBinding.Binders;
-using AutoMapper;
+using umbraco.cms.businesslogic.web;
+using umbraco.presentation.preview;
 using Umbraco.Core;
 using Umbraco.Core.Logging;
 using Umbraco.Core.Models;
@@ -17,24 +17,13 @@
 using Umbraco.Core.Persistence.DatabaseModelDefinitions;
 using Umbraco.Core.Publishing;
 using Umbraco.Core.Services;
-using Umbraco.Web.Models;
 using Umbraco.Web.Models.ContentEditing;
 using Umbraco.Web.Models.Mapping;
 using Umbraco.Web.Mvc;
-using Umbraco.Web.Security;
 using Umbraco.Web.WebApi;
 using Umbraco.Web.WebApi.Binders;
 using Umbraco.Web.WebApi.Filters;
-using umbraco;
-using Umbraco.Core.Models;
-using Umbraco.Core.Dynamics;
-using umbraco.BusinessLogic.Actions;
-using umbraco.cms.businesslogic.web;
-using umbraco.presentation.preview;
-using Umbraco.Core.PropertyEditors;
-using Umbraco.Web.UI;
 using Constants = Umbraco.Core.Constants;
-using Notification = Umbraco.Web.Models.ContentEditing.Notification;

 namespace Umbraco.Web.Editors
 {
@@ -658,13 +647,14 @@
                 }

                 //check if the item is allowed under this one
-                if (parent.ContentType.AllowedContentTypes.Select(x => x.Id).ToArray()
-                        .Any(x => x.Value == toMove.ContentType.Id) == false)
-                {
-                    throw new HttpResponseException(
-                            Request.CreateNotificationValidationErrorResponse(
-                                    Services.TextService.Localize("moveOrCopy/notAllowedByContentType")));
-                }
+                // not suitable for webcentrum workflow where allowed doctypes are dynamic
+                //if (parent.ContentType.AllowedContentTypes.Select(x => x.Id).ToArray()
+                //        .Any(x => x.Value == toMove.ContentType.Id) == false)
+                //{
+                //    throw new HttpResponseException(
+                //            Request.CreateNotificationValidationErrorResponse(
+                //                    Services.TextService.Localize("moveOrCopy/notAllowedByContentType")));
+                //}

                 // Check on paths
                 if ((string.Format(",{0},", parent.Path)).IndexOf(string.Format(",{0},", toMove.Id), StringComparison.Ordinal) > -1)


Reverts meadia sort to legacy dialog

Reverts meadia sort to legacy dialog

--- src/Umbraco.Web/Trees/MediaTreeController.cs
+++ src/Umbraco.Web/Trees/MediaTreeController.cs
@@ -77,7 +77,7 @@

                 // root actions
                 menu.AddMenuItem<ActionNew>();
-                menu.AddMenuItem<ActionSort>(true);
+                menu.AddMenuItem<ActionSort>(true).ConvertLegacyMenuItem(null, "media", "media");
                 menu.AddMenuItem<RefreshNode, ActionRefresh>(true);
                 return menu;
             }
@@ -94,9 +94,9 @@
             }
             //return a normal node menu:
             menu.AddMenuItem<ActionNew>();
-            menu.AddMenuItem<ActionMove>().ConvertLegacyMenuItem(item, "media", "media");
+            menu.AddMenuItem<ActionMove>();
             menu.AddMenuItem<ActionDelete>();
-            menu.AddMenuItem<ActionSort>();
+            menu.AddMenuItem<ActionSort>().ConvertLegacyMenuItem(null, "media", "media");
             menu.AddMenuItem<ActionRefresh>(true);
             return menu;
         }


Creates a virtual ConfigureUmbracoUserManager in UmbracoDefaultOwinStartup so inheritors can just override that if they want to simplify the startup owin code process

--- src/Umbraco.Web/UmbracoDefaultOwinStartup.cs
+++ src/Umbraco.Web/UmbracoDefaultOwinStartup.cs
@@ -37,12 +37,7 @@
         protected virtual void ConfigureServices(IAppBuilder app)
         {
             app.SetUmbracoLoggerFactory();
-
-            //Configure the Identity user manager for use with Umbraco Back office
-            // (EXPERT: an overload accepts a custom BackOfficeUserStore implementation)
-            app.ConfigureUserManagerForUmbracoBackOffice(
-                ApplicationContext,
-                Core.Security.MembershipProviderExtensions.GetUsersMembershipProvider().AsUmbracoMembershipProvider());
+            ConfigureUmbracoUserManager(app);
         }

         /// <summary>
@@ -62,7 +57,19 @@
         }

         /// <summary>
-        /// Raised when the middelware has been configured
+        /// Configure the Identity user manager for use with Umbraco Back office
+        /// </summary>
+        /// <param name="app"></param>
+        protected virtual void ConfigureUmbracoUserManager(IAppBuilder app)
+        {
+            // (EXPERT: an overload accepts a custom BackOfficeUserStore implementation)
+            app.ConfigureUserManagerForUmbracoBackOffice(
+                ApplicationContext,
+                Core.Security.MembershipProviderExtensions.GetUsersMembershipProvider().AsUmbracoMembershipProvider());
+        }
+
+        /// <summary>
+        /// Raised when the middleware has been configured
         /// </summary>
         public static event EventHandler<OwinMiddlewareConfiguredEventArgs> MiddlewareConfigured;


A test to see if watin will work.

A test to see if watin will work.

--- src/Volta.Tests/Acceptance/Common/WebPage.cs
+++ src/Volta.Tests/Acceptance/Common/WebPage.cs
@@ -35,7 +35,7 @@

         public WebPage GoHome()
         {
-            Browser.GoToNoWait(BaseUrl);
+            Browser.GoTo(BaseUrl);
             return this;
         }

@@ -74,7 +74,7 @@
         protected WebPage NavigateTo(WebPage fromPage, Uri url)
         {
             Browser = fromPage.Browser;
-            Browser.GoToNoWait(url != null ? new Uri(BaseUrl, url) : BaseUrl);
+            Browser.GoTo(url != null ? new Uri(BaseUrl, url) : BaseUrl);
             return this;
         }
     }


Ensure directory exists before writing files.

--- src/WebJobs.Script/Extensions/FileUtility.cs
+++ src/WebJobs.Script/Extensions/FileUtility.cs
@@ -76,10 +76,24 @@
             }

             encoding = encoding ?? Encoding.UTF8;
-            using (Stream fileStream = OpenFile(path, FileMode.Create, FileAccess.Write, FileShare.Read))
-            using (var writer = new StreamWriter(fileStream, encoding, 4096))
-            {
-                await writer.WriteAsync(contents);
+
+            try
+            {
+                await TryWrite();
+            }
+            catch (DirectoryNotFoundException)
+            {
+                EnsureDirectoryExists(Path.GetDirectoryName(path));
+                await TryWrite();
+            }
+
+            async Task TryWrite()
+            {
+                using (Stream fileStream = OpenFile(path, FileMode.Create, FileAccess.Write, FileShare.Read))
+                using (var writer = new StreamWriter(fileStream, encoding, 4096))
+                {
+                    await writer.WriteAsync(contents);
+                }
             }
         }


fix build

fix build

--- src/WeihanLi.Common/Aspect/AspectDelegate.cs
+++ src/WeihanLi.Common/Aspect/AspectDelegate.cs
@@ -43,10 +43,10 @@
                     return task;
                 }
 #if NETSTANDARD2_1
-                    if (context.ReturnValue is ValueTask valTask)
-                    {
-                        return valTask.AsTask();
-                    }
+                if (invocation.ReturnValue is ValueTask valTask)
+                {
+                    return valTask.AsTask();
+                }
 #endif

                 return TaskHelper.CompletedTask;


Update test baselines after merge.

Update test baselines after merge.

--- src/Compilers/CSharp/Test/Emit/CodeGen/CodeGenStackAllocInitializerTests.cs
+++ src/Compilers/CSharp/Test/Emit/CodeGen/CodeGenStackAllocInitializerTests.cs
@@ -483,24 +483,23 @@
 ", options: TestOptions.UnsafeReleaseExe, parseOptions: TestOptions.Regular.WithLanguageVersion(LanguageVersion.CSharp7_3));
             CompileAndVerify(comp, verify: Verification.Fails, expectedOutput: @"123")
                 .VerifyIL("C.Main",
-@"{
-  // Code size       23 (0x17)
-  .maxstack  4
-  .locals init (int V_0)
+@"
+{
+  // Code size       21 (0x15)
+  .maxstack  4
   IL_0000:  ldc.i4.3
-  IL_0001:  stloc.0
-  IL_0002:  ldloc.0
-  IL_0003:  conv.u
-  IL_0004:  localloc
-  IL_0006:  dup
-  IL_0007:  ldsflda    ""<PrivateImplementationDetails>.__StaticArrayInitTypeSize=3 <PrivateImplementationDetails>.7037807198C22A7D2B0807371D763779A84FDFCF""
-  IL_000c:  ldc.i4.3
-  IL_000d:  cpblk
-  IL_000f:  ldloc.0
-  IL_0010:  newobj     ""System.Span<byte>..ctor(void*, int)""
-  IL_0015:  pop
-  IL_0016:  ret
-}");
+  IL_0001:  conv.u
+  IL_0002:  localloc
+  IL_0004:  dup
+  IL_0005:  ldsflda    ""<PrivateImplementationDetails>.__StaticArrayInitTypeSize=3 <PrivateImplementationDetails>.7037807198C22A7D2B0807371D763779A84FDFCF""
+  IL_000a:  ldc.i4.3
+  IL_000b:  cpblk
+  IL_000d:  ldc.i4.3
+  IL_000e:  newobj     ""System.Span<byte>..ctor(void*, int)""
+  IL_0013:  pop
+  IL_0014:  ret
+}
+");
         }

         [Fact]
@@ -535,39 +534,36 @@
 ", options: TestOptions.UnsafeReleaseExe, parseOptions: TestOptions.Regular.WithLanguageVersion(LanguageVersion.CSharp7_3));
             CompileAndVerify(comp, verify: Verification.Fails, expectedOutput: @"123")
                 .VerifyIL("C.Main",
-@"{
-  // Code size       37 (0x25)
-  .maxstack  4
-  .locals init (int V_0)
-  IL_0000:  ldc.i4.3
-  IL_0001:  stloc.0
-  IL_0002:  ldloc.0
-  IL_0003:  conv.u
-  IL_0004:  ldc.i4.4
-  IL_0005:  mul.ovf.un
-  IL_0006:  localloc
+@"
+{
+  // Code size       34 (0x22)
+  .maxstack  4
+  IL_0000:  ldc.i4.s   12
+  IL_0002:  conv.u
+  IL_0003:  localloc
+  IL_0005:  dup
+  IL_0006:  ldc.i4.1
+  IL_0007:  stind.i4
   IL_0008:  dup
-  IL_0009:  ldc.i4.1
-  IL_000a:  stind.i4
-  IL_000b:  dup
-  IL_000c:  ldc.i4.4
-  IL_000d:  add
+  IL_0009:  ldc.i4.4
+  IL_000a:  add
+  IL_000b:  ldc.i4.2
+  IL_000c:  stind.i4
+  IL_000d:  dup
   IL_000e:  ldc.i4.2
-  IL_000f:  stind.i4
-  IL_0010:  dup
-  IL_0011:  ldc.i4.2
-  IL_0012:  conv.i
-  IL_0013:  ldc.i4.4
-  IL_0014:  mul
-  IL_0015:  add
-  IL_0016:  ldc.i4.3
-  IL_0017:  stind.i4
-  IL_0018:  ldloc.0
-  IL_0019:  newobj     ""System.Span<int>..ctor(void*, int)""
-  IL_001e:  call       ""System.ReadOnlySpan<int> System.ReadOnlySpan<int>.op_Implicit(System.Span<int>)""
-  IL_0023:  pop
-  IL_0024:  ret
-}");
+  IL_000f:  conv.i
+  IL_0010:  ldc.i4.4
+  IL_0011:  mul
+  IL_0012:  add
+  IL_0013:  ldc.i4.3
+  IL_0014:  stind.i4
+  IL_0015:  ldc.i4.3
+  IL_0016:  newobj     ""System.Span<int>..ctor(void*, int)""
+  IL_001b:  call       ""System.ReadOnlySpan<int> System.ReadOnlySpan<int>.op_Implicit(System.Span<int>)""
+  IL_0020:  pop
+  IL_0021:  ret
+}
+");
         }

         private static string GetSource(string pointerType) => $@"


Fix the UITests.Name duplication bug

Fix the UITests.Name duplication bug

--- src/DotVVM.Framework.Tools.SeleniumGenerator/SeleniumPageObjectGenerator.cs
+++ src/DotVVM.Framework.Tools.SeleniumGenerator/SeleniumPageObjectGenerator.cs
@@ -25,11 +25,13 @@
     {
         private readonly DotvvmConfiguration dotvvmConfig;
         private readonly ConcurrentDictionary<string, Task<IAbstractTreeRoot>> resolvedTreeRoots;
+        private readonly ConcurrentDictionary<string, Task> updatedMarkupFiles;

         public SeleniumPageObjectGenerator(SeleniumGeneratorOptions options, DotvvmConfiguration dotvvmConfig)
         {
             this.dotvvmConfig = dotvvmConfig;
             this.resolvedTreeRoots = new ConcurrentDictionary<string, Task<IAbstractTreeRoot>>();
+            updatedMarkupFiles = new ConcurrentDictionary<string, Task>();
             visitor = new SeleniumPageObjectVisitor(this);
             visitor.DiscoverControlGenerators(options);
         }
@@ -59,7 +61,7 @@
             GeneratePageObjectClass(seleniumConfiguration, pageObject);

             // update view markup file
-            UpdateMarkupFile(pageObject, seleniumConfiguration.ViewFullPath);
+            await UpdateMarkupFile(pageObject, seleniumConfiguration.ViewFullPath);
         }

         public Task<IAbstractTreeRoot> ResolveControlTree(string filePath)
@@ -108,7 +110,7 @@

             foreach (var pageObjectDefinition in pageObjectDefinitions)
             {
-                UpdateMarkupFile(pageObjectDefinition, pageObjectDefinition.MasterPageFullPath);
+                await UpdateMarkupFile(pageObjectDefinition, pageObjectDefinition.MasterPageFullPath);
             }

             return pageObjectDefinitions;
@@ -164,23 +166,18 @@
             return view.Directives.ContainsKey(ParserConstants.MasterPageDirective);
         }

-        private void UpdateMarkupFile(PageObjectDefinition pageObject, string viewPath)
-        {
-            var sb = new StringBuilder(File.ReadAllText(viewPath, Encoding.UTF8));
-
-            UpdateMarkupFile(pageObject, sb);
-
-            File.WriteAllText(viewPath, sb.ToString(), Encoding.UTF8);
-        }
-
-        private void UpdateMarkupFile(PageObjectDefinition pageObject, StringBuilder stringBuilder)
-        {
-            var allModifications = GetAllModifications(pageObject);
-
-            foreach (var modification in allModifications.OrderByDescending(m => m.Position))
-            {
-                modification.Apply(stringBuilder);
-            }
+        private Task UpdateMarkupFile(PageObjectDefinition pageObject, string viewPath)
+        {
+            return updatedMarkupFiles.GetOrAdd(viewPath, _ => Task.Run(() => {
+                var sb = new StringBuilder(File.ReadAllText(viewPath, Encoding.UTF8));
+                var allModifications = GetAllModifications(pageObject);
+
+                foreach (var modification in allModifications.OrderByDescending(m => m.Position))
+                {
+                    modification.Apply(sb);
+                }
+                File.WriteAllText(viewPath, sb.ToString(), Encoding.UTF8);
+            }));
         }

         private IEnumerable<Testing.SeleniumGenerator.Modifications.MarkupFileModification> GetAllModifications(PageObjectDefinition pageObject)


Adding logging info messages to Standard Repository

--- src/Esfa.Vacancy.Register.Infrastructure/Repositories/StandardRepository.cs
+++ src/Esfa.Vacancy.Register.Infrastructure/Repositories/StandardRepository.cs
@@ -1,6 +1,7 @@
 using System.Collections.Generic;
 using System.Data;
 using System.Data.SqlClient;
+using System.Linq;
 using System.Threading.Tasks;
 using Dapper;
 using Esfa.Vacancy.Register.Domain.Repositories;
@@ -34,6 +35,8 @@

         private async Task<IEnumerable<int>> InternalGetStandardIdsAsync()
         {
+            _logger.Info("Querying AVMS database for Standard Codes");
+
             var connectionString =
                 _provideSettings.GetSetting(ApplicationSettingKeyConstants.AvmsPlusDatabaseConnectionStringKey);

@@ -45,6 +48,8 @@
                     await sqlConn.QueryAsync<int>(GetActiveStandardCodesSqlSproc,
                         commandType: CommandType.StoredProcedure);

+                _logger.Info($"Retrieved {results.Count()} Framework Codes from AVMS database.");
+
                 return results;
             }
         }


Remove useless Program.cs

Remove useless Program.cs

--- src/Infrastructure/Tests/Riganti.Utils.Infrastructure.Core.Tests/Program.cs
+++ src/Infrastructure/Tests/Riganti.Utils.Infrastructure.Core.Tests/Program.cs
@@ -1,14 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Threading.Tasks;
-
-namespace Riganti.Utils.Infrastructure.Core.Tests
-{
-    public class Program
-    {
-        public static void Main(string[] args)
-        {
-        }
-    }
-}


Little hack on EquivalenceClassCollection to validate the new equality contract verifier, before removing completely the generic constraint and refactoring the comparison contract verifier accordingly.

--- src/MbUnit/MbUnit/Framework/ContractVerifiers/EquivalenceClassCollection.cs
+++ src/MbUnit/MbUnit/Framework/ContractVerifiers/EquivalenceClassCollection.cs
@@ -53,14 +53,13 @@
     /// <typeparam name="T">The type of equivalent object instances.</typeparam>
     public class EquivalenceClassCollection<T> : IEnumerable<EquivalenceClass<T>>
     {
-        private readonly List<EquivalenceClass<T>> equivalenceClasses;
+        private readonly List<EquivalenceClass<T>> equivalenceClasses = new List<EquivalenceClass<T>>();

         /// <summary>
         /// Constructs an empty collection of equivalence classes.
         /// </summary>
         public EquivalenceClassCollection()
         {
-            equivalenceClasses = new List<EquivalenceClass<T>>();
         }

         /// <summary>
@@ -109,7 +108,6 @@
         /// </example>
         /// <param name="distinctInstances">An enumeration of distinct instances.</param>
         public EquivalenceClassCollection(IEnumerable<T> distinctInstances)
-            : this()
         {
             if (distinctInstances == null)
                 throw new ArgumentNullException("distinctInstances");
@@ -181,9 +179,15 @@
         /// several equivalent instances, use preferably the default constructor followed by a list initializer.
         /// </para>
         /// </remarks>
-        public EquivalenceClassCollection(IEnumerable<object> distinctInstances)
-            : base(distinctInstances)
+        public EquivalenceClassCollection(IEnumerable distinctInstances)
+            : base(Cast(distinctInstances))
         {
         }
-  }
+
+        private static IEnumerable<object> Cast(IEnumerable enumeration)
+        {
+            foreach (object value in enumeration)
+                yield return value;
+        }
+    }
 }


Remove custom constructor from WheelOfFortune class.

--- src/MitternachtBot/Modules/Gambling/Common/WheelOfFortune/WheelOfFortune.cs
+++ src/MitternachtBot/Modules/Gambling/Common/WheelOfFortune/WheelOfFortune.cs
@@ -26,12 +26,8 @@
 			2.4f,
 		}.ToImmutableArray();

-		public int Result { get; }
-		public string Emoji => _emojis[Result];
-		public float Multiplier => Multipliers[Result];
-
-		public WheelOfFortune() {
-			this.Result = _rng.Next(0, 8);
-		}
+		public readonly int    Result     =  _rng.Next(0, 8);
+		public          string Emoji      => _emojis[Result];
+		public          float  Multiplier => Multipliers[Result];
 	}
 }


redirect to access denied view

redirect to access denied view

--- src/SFA.DAS.EmployerAccounts.Web/Controllers/EmployerAgreementController.cs
+++ src/SFA.DAS.EmployerAccounts.Web/Controllers/EmployerAgreementController.cs
@@ -55,17 +55,17 @@
         [Route("agreements")]
         public async Task<ActionResult> Index(string hashedAccountId, bool agreementSigned = false)
         {
-            var model = await _orchestrator.Get(hashedAccountId, OwinWrapper.GetClaimValue(ControllerConstants.UserRefClaimKeyName));
-
-            var flashMessage = GetFlashMessageViewModelFromCookie();
-            if (flashMessage != null)
-            {
-                model.FlashMessage = flashMessage;
-            }
-
-            ViewBag.ShowConfirmation = agreementSigned && model.Data.EmployerAgreementsData.HasPendingAgreements;
-
-            return View(model);
+                var model = await _orchestrator.Get(hashedAccountId, OwinWrapper.GetClaimValue(ControllerConstants.UserRefClaimKeyName));
+
+                var flashMessage = GetFlashMessageViewModelFromCookie();
+                if (flashMessage != null)
+                {
+                    model.FlashMessage = flashMessage;
+                }
+
+                ViewBag.ShowConfirmation = agreementSigned && model.Data.EmployerAgreementsData.HasPendingAgreements;
+
+                return View(model);
         }

         [HttpGet]
@@ -87,9 +87,16 @@
         public async Task<ActionResult> View(string agreementId, string hashedAccountId,
             FlashMessageViewModel flashMessage)
         {
-            var agreement = await GetSignedAgreementViewModel(new GetEmployerAgreementRequest { AgreementId = agreementId, HashedAccountId = hashedAccountId, ExternalUserId = OwinWrapper.GetClaimValue(ControllerConstants.UserRefClaimKeyName) });
-
-            return View(agreement);
+            try
+            {
+                var agreement = await GetSignedAgreementViewModel(new GetEmployerAgreementRequest { AgreementId = agreementId, HashedAccountId = hashedAccountId, ExternalUserId = OwinWrapper.GetClaimValue(ControllerConstants.UserRefClaimKeyName) });
+
+                return View(agreement);
+            }
+            catch (UnauthorizedAccessException)
+            {
+                return AccessDeniedView();
+            }
         }

         [HttpGet]
@@ -122,14 +129,33 @@
         [Route("agreements/{agreementId}/sign-your-agreement")]
         public async Task<ActionResult> SignAgreement(GetEmployerAgreementRequest request)
         {
-            request.ExternalUserId = OwinWrapper.GetClaimValue(ControllerConstants.UserRefClaimKeyName);
-
-            var viewModel = await GetSignedAgreementViewModel(request);
-            var entities = await _mediator.SendAsync(new GetAccountLegalEntitiesCountByHashedAccountIdRequest { HashedAccountId = request.HashedAccountId });
-
-            viewModel.LegalEntitiesCount = entities.LegalEntitiesCount;
-
-            return View(viewModel);
+            try
+            {
+                request.ExternalUserId = OwinWrapper.GetClaimValue(ControllerConstants.UserRefClaimKeyName);
+
+                var viewModel = await GetSignedAgreementViewModel(request);
+                var entities = await _mediator.SendAsync(new GetAccountLegalEntitiesCountByHashedAccountIdRequest { HashedAccountId = request.HashedAccountId });
+
+                viewModel.LegalEntitiesCount = entities.LegalEntitiesCount;
+
+                return View(viewModel);
+            }
+            catch (UnauthorizedAccessException)
+            {
+                return AccessDeniedView();
+            }
+        }
+
+        private ActionResult AccessDeniedView()
+        {
+            var accountId = Request.Params[ControllerConstants.AccountHashedIdRouteKeyName];
+
+            if (accountId != null)
+            {
+                ViewBag.AccountId = accountId;
+            }
+
+            return base.View(ControllerConstants.AccessDeniedViewName);
         }

         [HttpPost]


Instagram: Added reference to the Instagram API

--- src/Skybrud.Social/Instagram/Endpoints/Raw/InstagramLocationsRawEndpoint.cs
+++ src/Skybrud.Social/Instagram/Endpoints/Raw/InstagramLocationsRawEndpoint.cs
@@ -5,7 +5,8 @@
 using Skybrud.Social.Instagram.Options.Locations;

 namespace Skybrud.Social.Instagram.Endpoints.Raw {
-
+
+    /// <see cref="http://instagram.com/developer/endpoints/locations/"/>
     public class InstagramLocationsRawEndpoint {

         #region Properties


typo: Double word "to" (dotnet/corefx#36264)

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

--- src/System.Private.CoreLib/shared/System/Diagnostics/Tracing/EventSource.cs
+++ src/System.Private.CoreLib/shared/System/Diagnostics/Tracing/EventSource.cs
@@ -2085,7 +2085,7 @@
                         SendManifest(manifestBuilder.CreateManifest());
                     }

-                    // We use this low level routine to to bypass the enabled checking, since the eventSource itself is only partially inited.
+                    // We use this low level routine to bypass the enabled checking, since the eventSource itself is only partially inited.
                     fixed (char* msgStringPtr = msgString)
                     {
                         EventDescriptor descr = new EventDescriptor(0, 0, 0, (byte)level, 0, 0, keywords);
@@ -3875,7 +3875,7 @@
                                 break;
                             if (cur == this)
                             {
-                                // Found our Listener, remove references to to it in the eventSources
+                                // Found our Listener, remove references to it in the eventSources
                                 prev.m_Next = cur.m_Next;       // Remove entry.
                                 RemoveReferencesToListenerInEventSources(cur);
                                 break;


Fix cast in CacheMemoryMonitor (#41776)

Fix cast in CacheMemoryMonitor (#41776)

Avoid overflow.

--- src/System.Runtime.Caching/src/System/Runtime/Caching/CacheMemoryMonitor.cs
+++ src/System.Runtime.Caching/src/System/Runtime/Caching/CacheMemoryMonitor.cs
@@ -235,7 +235,7 @@

         internal void SetLimit(int cacheMemoryLimitMegabytes)
         {
-            long cacheMemoryLimit = cacheMemoryLimitMegabytes << MEGABYTE_SHIFT;
+            long cacheMemoryLimit = ((long)cacheMemoryLimitMegabytes) << MEGABYTE_SHIFT;
             _memoryLimit = cacheMemoryLimit != 0 ?
                 cacheMemoryLimit :
                 EffectiveProcessMemoryLimit;


Cleanup.

Cleanup.

--- src/Workspaces/CSharp/Portable/LanguageServices/CSharpSyntaxFactsService.cs
+++ src/Workspaces/CSharp/Portable/LanguageServices/CSharpSyntaxFactsService.cs
@@ -1965,10 +1965,13 @@
             return null;
         }

-        public SyntaxNode GetContainingPropertyDeclaration(SyntaxNode node) => node.GetAncestorOrThis<PropertyDeclarationSyntax>();
-
-        public SyntaxNode GetContainingParameter(SyntaxNode node) => node.GetAncestorOrThis<ParameterSyntax>();
-
-        public override SyntaxList<SyntaxNode> GetAttributeLists(SyntaxNode node) => CSharpSyntaxGenerator.GetAttributeLists(node);
+        public SyntaxNode GetContainingPropertyDeclaration(SyntaxNode node)
+            => node.GetAncestorOrThis<PropertyDeclarationSyntax>();
+
+        public SyntaxNode GetContainingParameter(SyntaxNode node)
+            => node.GetAncestorOrThis<ParameterSyntax>();
+
+        public override SyntaxList<SyntaxNode> GetAttributeLists(SyntaxNode node)
+            => CSharpSyntaxGenerator.GetAttributeLists(node);
     }
 }


Ordinamento interventi - Ordinati dal più vecchio al più recente

--- src/backend/SO115App.Persistence.MongoDB/GestioneInterventi/GetRichiesta.cs
+++ src/backend/SO115App.Persistence.MongoDB/GestioneInterventi/GetRichiesta.cs
@@ -270,8 +270,8 @@
                     .ThenByDescending(c => c.StatoRichiesta is Assegnata)
                     .ThenByDescending(c => c.StatoRichiesta is Presidiata)
                     .ThenByDescending(c => c.StatoRichiesta is Chiusa)
-                    .ThenByDescending(x => x.PrioritaRichiesta)
-                    .ThenByDescending(x => x.IstanteRicezioneRichiesta)
+                    //.ThenByDescending(x => x.PrioritaRichiesta)
+                    .ThenBy(x => x.IstanteRicezioneRichiesta)
                     .Skip((filtro.Page - 1) * filtro.PageSize).Take(filtro.PageSize).ToList();
                 }
             }
@@ -294,8 +294,8 @@
                     .ThenByDescending(c => c.Stato.Equals(Costanti.RichiestaAssegnata))
                     .ThenByDescending(c => c.Stato.Equals(Costanti.RichiestaPresidiata))
                     .ThenByDescending(c => c.Stato.Equals(Costanti.RichiestaChiusa))
-                    .ThenByDescending(x => x.PrioritaRichiesta)
-                    .ThenByDescending(x => x.IstanteRicezioneRichiesta)
+                    //.ThenByDescending(x => x.PrioritaRichiesta)
+                    .ThenBy(x => x.IstanteRicezioneRichiesta)
                     .ToList();
         }


added test for GetObject() behavior

added test for GetObject() behavior

--- test/Spring/Spring.Core.Tests/Context/Support/XmlApplicationContextTests.cs
+++ test/Spring/Spring.Core.Tests/Context/Support/XmlApplicationContextTests.cs
@@ -117,6 +117,17 @@
             Assert.IsTrue(ctx.ContainsObject("GORAN"));
             Assert.AreEqual(ctx.GetObject("goran"), ctx.GetObject("GORAN"));
         }
+
+        [Test]
+        [ExpectedException(typeof(NoSuchObjectDefinitionException))]
+        public void GetObjectOnUnknownIdThrowsNoSuchObjectDefinition()
+        {
+            XmlApplicationContext ctx =
+                new XmlApplicationContext(false, "assembly://Spring.Core.Tests/Spring.Context.Support/objects.xml");
+            string DOES_NOT_EXIST = "does_not_exist";
+            Assert.IsFalse(ctx.ContainsObject(DOES_NOT_EXIST));
+            Assert.IsNull(ctx.GetObject(DOES_NOT_EXIST));
+        }

         [Test]
         public void FactoryObjectsAreNotInstantiatedBeforeObjectFactoryPostProcessorsAreApplied()


Add comment noting tight-coupling of a-vs-an scanner and query

--- A-vs-An/WikipediaAvsAnTrieExtractor/RegexTextUtils.ExtractWordsAfterAOrAn.cs
+++ A-vs-An/WikipediaAvsAnTrieExtractor/RegexTextUtils.ExtractWordsAfterAOrAn.cs
@@ -8,7 +8,10 @@
         //Note: regexes are NOT static and shared because of... http://stackoverflow.com/questions/7585087/multithreaded-use-of-regex
         //This code is bottlenecked by regexes, so this really matters, here.

+
+        //If you change this, keep WordQuery char-skipping in Query in sync!
         readonly Regex followingAn = new Regex(@"(^(?
An?)|[\s""()‘’“”](?
an?)) [""‘’“”$']*(?<word>[^\s""()‘’“”$-]+(?<!'))", RegexOptions.Compiled | RegexOptions.ExplicitCapture | RegexOptions.CultureInvariant);
+
         //general notes:
         //words consist of anything BUT spaces and delimiters "()‘’“”-
         //dash is a word delimiter in pronunciation, which is all we care about here


Added new feature as per Aspose.Imaging for .NET 17.11 release

SavingSVGWithFonts.cs

--- Examples/CSharp/ModifyingAndConvertingImages/MetaFiles/SavingSVGWithFonts.cs
+++ Examples/CSharp/ModifyingAndConvertingImages/MetaFiles/SavingSVGWithFonts.cs
@@ -7,7 +7,8 @@
 {

     #region Constants
-
+
+        // ExStart:SavingSVGWithFonts
     private const string FontFolderName = "fonts";
     private const string OutFolderName = "Out";
     private const string SourceFolder = @"D:\FontTests";
@@ -207,5 +208,8 @@
         }

         #endregion
+
+    //ExEnd:SavingSVGWithFonts
+
     }
 }


#174 fix empty links

#174 fix empty links

--- MailRuCloud/MailRuCloudApi/Base/Repos/YandexDisk/YadWeb/YadWebRequestRepo.cs
+++ MailRuCloud/MailRuCloudApi/Base/Repos/YandexDisk/YadWeb/YadWebRequestRepo.cs
@@ -44,6 +44,7 @@
                 .MakeRequestAsync();

             var res = folderInfo.Data.Resources
+                .Where(it => !string.IsNullOrEmpty(it.Meta?.UrlShort))
                 .ToDictionary(
                     it => it.Path.Remove(0, "/disk".Length),
                     it => Enumerable.Repeat(new PublicLinkInfo("short", it.Meta.UrlShort), 1));


fixing test

--- NugetVisualizer/UnitTests/IntegrationTests/DbTests/PackageRepositoryTests.cs
+++ NugetVisualizer/UnitTests/IntegrationTests/DbTests/PackageRepositoryTests.cs
@@ -141,12 +141,13 @@

         private void ThenCorrectOrderReturnedForMostUsedPackages()
         {
-            _mostUsedPackages.Keys.Count.ShouldBe(5);
-            _mostUsedPackages[_mostUsedPackages.Keys.Single(p => p.Name.Equals("MostUsed"))].ShouldBe(9);
-            _mostUsedPackages[_mostUsedPackages.Keys.Single(p => p.Name.Equals("SecondMostUsed"))].ShouldBe(6);
-            _mostUsedPackages[_mostUsedPackages.Keys.Single(p => p.Name.Equals("ThirdMostUsed"))].ShouldBe(3);
-            _mostUsedPackages[_mostUsedPackages.Keys.Single(p => p.Name.Equals("FourthMostUsed"))].ShouldBe(3);
-            _mostUsedPackages[_mostUsedPackages.Keys.Single(p => p.Name.Equals("FifthMostUsed"))].ShouldBe(1);
+            var filteredResults = _mostUsedPackages.Where(x => new [] { "MostUsed", "SecondMostUsed", "ThirdMostUsed", "FourthMostUsed", "FifthMostUsed" }.Contains(x.Key.Name)).ToDictionary(x => x.Key, x => x.Value); // this is a workaround because the tests share the database. should be fixed as part of https://github.com/sepharg/NugetVisualizer/issues/5 (basically remove the filter)
+            filteredResults.Keys.Count.ShouldBe(5);
+            filteredResults[filteredResults.Keys.Single(p => p.Name.Equals("MostUsed"))].ShouldBe(9);
+            filteredResults[filteredResults.Keys.Single(p => p.Name.Equals("SecondMostUsed"))].ShouldBe(6);
+            filteredResults[filteredResults.Keys.Single(p => p.Name.Equals("ThirdMostUsed"))].ShouldBe(3);
+            filteredResults[filteredResults.Keys.Single(p => p.Name.Equals("FourthMostUsed"))].ShouldBe(3);
+            filteredResults[filteredResults.Keys.Single(p => p.Name.Equals("FifthMostUsed"))].ShouldBe(1);
         }

         private void ThenCorrectOrderReturned()


Removes duplicate code

Removes duplicate code

--- OfficeDevPnP.Core/OfficeDevPnP.Core/AppModelExtensions/SecurityExtensions.cs
+++ OfficeDevPnP.Core/OfficeDevPnP.Core/AppModelExtensions/SecurityExtensions.cs
@@ -823,53 +823,18 @@

         public static Guid GetAuthenticationRealm(this Web web)
         {
+
             Guid returnGuid = Guid.Empty;
             if (!web.IsPropertyAvailable("Url"))
             {
                 web.Context.Load(web, w => w.Url);
                 web.Context.ExecuteQuery();
             }
-            WebRequest request = WebRequest.Create(new Uri(web.Url) + "/_vti_bin/client.svc");
-            request.Headers.Add("Authorization: Bearer ");
-
-            try
-            {
-                using (request.GetResponse())
-                {
-                }
-            }
-            catch (WebException e)
-            {
-                if (e.Response == null)
-                {
-                }
-
-                string bearerResponseHeader = e.Response.Headers["WWW-Authenticate"];
-                if (string.IsNullOrEmpty(bearerResponseHeader))
-                {
-                }
-
-                const string bearer = "Bearer realm=\"";
-                int bearerIndex = bearerResponseHeader.IndexOf(bearer, StringComparison.Ordinal);
-                if (bearerIndex < 0)
-                {
-                }
-
-                int realmIndex = bearerIndex + bearer.Length;
-
-                if (bearerResponseHeader.Length >= realmIndex + 36)
-                {
-                    string targetRealm = bearerResponseHeader.Substring(realmIndex, 36);
-
-                    Guid realmGuid;
-
-                    if (Guid.TryParse(targetRealm, out realmGuid))
-                    {
-                        returnGuid = realmGuid;
-                    }
-                }
-            }
+
+            returnGuid = new Guid(OfficeDevPnP.Core.Utilities.TokenHelper.GetRealmFromTargetUrl(new Uri(web.Url)));
+
             return returnGuid;
+
         }
     }
 }


Updated UserInfo group enumeration property to ignore group SID's that fail to translate to an active AD group, for whatever reason

git-tfs-id: [https://tfs.codeplex.com/tfs/TFS05]$/tvacodelibrary/Main;C85952

--- Source/OldCode/TVACodeLibrary/Source/Libraries/TVA.Core/Identity/UserInfo.cs
+++ Source/OldCode/TVACodeLibrary/Source/Libraries/TVA.Core/Identity/UserInfo.cs
@@ -986,7 +986,14 @@

                         foreach (byte[] sid in m_userEntry.Properties["TokenGroups"])
                         {
-                            groups.Add(new SecurityIdentifier(sid, 0).Translate(typeof(NTAccount)).ToString());
+                            try
+                            {
+                                groups.Add(new SecurityIdentifier(sid, 0).Translate(typeof(NTAccount)).ToString());
+                            }
+                            catch
+                            {
+                                // Ignoring group SID's that fail to translate to an active AD group, for whatever reason
+                            }
                         }
                     }
                 }


Modified the ConfigurationSetupUtility to force LogToDatabase to false when using SQLite.

--- Source/Tools/ConfigurationSetupUtility/Screens/SetupInProgressScreen.xaml.cs
+++ Source/Tools/ConfigurationSetupUtility/Screens/SetupInProgressScreen.xaml.cs
@@ -1859,7 +1859,7 @@
                     addElement.Attributes.Append(attribute);

                     attribute = configFile.CreateAttribute("value");
-                    attribute.Value = "True";
+                    attribute.Value = (m_state["newDatabaseType"].ToString() != "SQLite").ToString();
                     addElement.Attributes.Append(attribute);

                     attribute = configFile.CreateAttribute("description");
@@ -1871,6 +1871,10 @@
                     addElement.Attributes.Append(attribute);

                     errorLoggerNode.AppendChild(addElement);
+                }
+                else if (m_state["newDatabaseType"].ToString() == "SQLite")
+                {
+                    logToDatabaseNode.Attributes["value"].Value = "False";
                 }
             }


Activate network object when spawn

Activate network object when spawn

--- Scripts/GameApi/LiteNetLibAssets.cs
+++ Scripts/GameApi/LiteNetLibAssets.cs
@@ -174,6 +174,7 @@
             if (GuidToPrefabs.TryGetValue(assetId, out spawningObject))
             {
                 var spawnedObject = Instantiate(spawningObject);
+                spawnedObject.gameObject.SetActive(true);
                 spawnedObject.transform.position = position;
                 spawnedObject.Initial(Manager, objectId, connectId);
                 SpawnedObjects[spawnedObject.ObjectId] = spawnedObject;


Allow statically bound Razor templates to be output cached

--- Source/Blade/Views/RazorTemplate.cs
+++ Source/Blade/Views/RazorTemplate.cs
@@ -33,5 +33,10 @@
 				output.Write(result);
 			}
 		}
+
+		protected override string GetCachingID()
+		{
+			return Path;
+		}
 	}
 }


CLR properties with public getter and private setter are visible from within PHP now.

git-tfs-id: [http://falcon:8080/tfs/Projects]$/Phalanger/Main;C2188

--- Source/Core/Reflection/TypeDescs.cs
+++ Source/Core/Reflection/TypeDescs.cs
@@ -3360,8 +3360,8 @@

 							// TODO: how to combine attrs?
 							PhpMemberAttributes attrs = PhpMemberAttributes.None;
-							if (getter != null) attrs = Enums.GetMemberAttributes(getter);
-							if (setter != null) attrs = Enums.GetMemberAttributes(setter);
+							if (has_visible_getter) attrs |= Enums.GetMemberAttributes(getter);
+                            if (has_visible_setter) attrs |= Enums.GetMemberAttributes(setter);

 							ReflectProperty(name, attrs, real_prop, has_visible_getter, has_visible_setter);
 						}


git-svn-id: svn://svn.code.sf.net/p/mediainfo/code/MediaInfoLib/trunk@1151 45c5ae6f-87cc-4fd0-92ee-e4f023fd80da

--- Source/MediaInfoDLL/MediaInfoDLL.cs
+++ Source/MediaInfoDLL/MediaInfoDLL.cs
@@ -87,25 +87,25 @@
     {
         //Import of DLL functions. DO NOT USE until you know what you do (MediaInfo DLL do NOT use CoTaskMemAlloc to allocate memory)
         [DllImport("MediaInfo.dll")]
-        public static extern IntPtr MediaInfo_New();
+        private static extern IntPtr MediaInfo_New();
         [DllImport("MediaInfo.dll")]
-        public static extern void MediaInfo_Delete(IntPtr Handle);
+        private static extern void MediaInfo_Delete(IntPtr Handle);
         [DllImport("MediaInfo.dll")]
-        public static extern IntPtr MediaInfo_Open(IntPtr Handle, [MarshalAs(UnmanagedType.LPWStr)] string FileName);
+        private static extern IntPtr MediaInfo_Open(IntPtr Handle, [MarshalAs(UnmanagedType.LPWStr)] string FileName);
         [DllImport("MediaInfo.dll")]
-        public static extern void MediaInfo_Close(IntPtr Handle);
+        private static extern void MediaInfo_Close(IntPtr Handle);
         [DllImport("MediaInfo.dll")]
-        public static extern IntPtr MediaInfo_Inform(IntPtr Handle, IntPtr Reserved);
+        private static extern IntPtr MediaInfo_Inform(IntPtr Handle, IntPtr Reserved);
         [DllImport("MediaInfo.dll")]
-        public static extern IntPtr MediaInfo_GetI(IntPtr Handle, IntPtr StreamKind, IntPtr StreamNumber, IntPtr Parameter, IntPtr KindOfInfo);
+        private static extern IntPtr MediaInfo_GetI(IntPtr Handle, IntPtr StreamKind, IntPtr StreamNumber, IntPtr Parameter, IntPtr KindOfInfo);
         [DllImport("MediaInfo.dll")]
-        public static extern IntPtr MediaInfo_Get(IntPtr Handle, IntPtr StreamKind, IntPtr StreamNumber, [MarshalAs(UnmanagedType.LPWStr)] string Parameter, IntPtr KindOfInfo, IntPtr KindOfSearch);
+        private static extern IntPtr MediaInfo_Get(IntPtr Handle, IntPtr StreamKind, IntPtr StreamNumber, [MarshalAs(UnmanagedType.LPWStr)] string Parameter, IntPtr KindOfInfo, IntPtr KindOfSearch);
         [DllImport("MediaInfo.dll")]
-        public static extern IntPtr MediaInfo_Option(IntPtr Handle, [MarshalAs(UnmanagedType.LPWStr)] string Option, [MarshalAs(UnmanagedType.LPWStr)] string Value);
+        private static extern IntPtr MediaInfo_Option(IntPtr Handle, [MarshalAs(UnmanagedType.LPWStr)] string Option, [MarshalAs(UnmanagedType.LPWStr)] string Value);
         [DllImport("MediaInfo.dll")]
-        public static extern IntPtr MediaInfo_State_Get(IntPtr Handle);
+        private static extern IntPtr MediaInfo_State_Get(IntPtr Handle);
         [DllImport("MediaInfo.dll")]
-        public static extern IntPtr MediaInfo_Count_Get(IntPtr Handle, IntPtr StreamKind, IntPtr StreamNumber);
+        private static extern IntPtr MediaInfo_Count_Get(IntPtr Handle, IntPtr StreamKind, IntPtr StreamNumber);

         //MediaInfo class
         public MediaInfo() { Handle = MediaInfo_New(); }
@@ -132,25 +132,25 @@
     {
         //Import of DLL functions. DO NOT USE until you know what you do (MediaInfo DLL do NOT use CoTaskMemAlloc to allocate memory)
         [DllImport("MediaInfo.dll")]
-        public static extern IntPtr MediaInfoList_New();
+        private static extern IntPtr MediaInfoList_New();
         [DllImport("MediaInfo.dll")]
-        public static extern void MediaInfoList_Delete(IntPtr Handle);
+        private static extern void MediaInfoList_Delete(IntPtr Handle);
         [DllImport("MediaInfo.dll")]
-        public static extern IntPtr MediaInfoList_Open(IntPtr Handle, [MarshalAs(UnmanagedType.LPWStr)] string FileName, IntPtr Options);
+        private static extern IntPtr MediaInfoList_Open(IntPtr Handle, [MarshalAs(UnmanagedType.LPWStr)] string FileName, IntPtr Options);
         [DllImport("MediaInfo.dll")]
-        public static extern void MediaInfoList_Close(IntPtr Handle, IntPtr FilePos);
+        private static extern void MediaInfoList_Close(IntPtr Handle, IntPtr FilePos);
         [DllImport("MediaInfo.dll")]
-        public static extern IntPtr MediaInfoList_Inform(IntPtr Handle, IntPtr FilePos, IntPtr Reserved);
+        private static extern IntPtr MediaInfoList_Inform(IntPtr Handle, IntPtr FilePos, IntPtr Reserved);
         [DllImport("MediaInfo.dll")]
-        public static extern IntPtr MediaInfoList_GetI(IntPtr Handle, IntPtr FilePos, IntPtr StreamKind, IntPtr StreamNumber, IntPtr Parameter, IntPtr KindOfInfo);
+        private static extern IntPtr MediaInfoList_GetI(IntPtr Handle, IntPtr FilePos, IntPtr StreamKind, IntPtr StreamNumber, IntPtr Parameter, IntPtr KindOfInfo);
         [DllImport("MediaInfo.dll")]
-        public static extern IntPtr MediaInfoList_Get(IntPtr Handle, IntPtr FilePos, IntPtr StreamKind, IntPtr StreamNumber, [MarshalAs(UnmanagedType.LPWStr)] string Parameter, IntPtr KindOfInfo, IntPtr KindOfSearch);
+        private static extern IntPtr MediaInfoList_Get(IntPtr Handle, IntPtr FilePos, IntPtr StreamKind, IntPtr StreamNumber, [MarshalAs(UnmanagedType.LPWStr)] string Parameter, IntPtr KindOfInfo, IntPtr KindOfSearch);
         [DllImport("MediaInfo.dll")]
-        public static extern IntPtr MediaInfoList_Option(IntPtr Handle, [MarshalAs(UnmanagedType.LPWStr)] string Option, [MarshalAs(UnmanagedType.LPWStr)] string Value);
+        private static extern IntPtr MediaInfoList_Option(IntPtr Handle, [MarshalAs(UnmanagedType.LPWStr)] string Option, [MarshalAs(UnmanagedType.LPWStr)] string Value);
         [DllImport("MediaInfo.dll")]
-        public static extern IntPtr MediaInfoList_State_Get(IntPtr Handle);
+        private static extern IntPtr MediaInfoList_State_Get(IntPtr Handle);
         [DllImport("MediaInfo.dll")]
-        public static extern IntPtr MediaInfoList_Count_Get(IntPtr Handle, IntPtr FilePos, IntPtr StreamKind, IntPtr StreamNumber);
+        private static extern IntPtr MediaInfoList_Count_Get(IntPtr Handle, IntPtr FilePos, IntPtr StreamKind, IntPtr StreamNumber);

         //MediaInfo class
         public MediaInfoList() { Handle = MediaInfoList_New(); }


Fixed attachment of textures to a framebuffer

--- Source/ObjectGL/GL42/Framebuffer.cs
+++ Source/ObjectGL/GL42/Framebuffer.cs
@@ -127,7 +127,7 @@
             };

             Attach(currentContext, attachmentPoint, ref newDesc, (FramebufferTarget ft, FramebufferAttachment fa, ref FramebufferAttachmentDescription d) =>
-                GL.FramebufferTexture1D(ft, fa, d.TextureTarget, d.Texture.Handle, d.Level));
+                GL.FramebufferTexture(ft, fa, d.Texture.Handle, d.Level));
         }

         public void AttachTextureImage(Context currentContext, FramebufferAttachmentPoint attachmentPoint, Texture1DArray texture, int level, int layer)
@@ -170,7 +170,7 @@
             };

             Attach(currentContext, attachmentPoint, ref newDesc, (FramebufferTarget ft, FramebufferAttachment fa, ref FramebufferAttachmentDescription d) =>
-                GL.FramebufferTexture2D(ft, fa, d.TextureTarget, d.Texture.Handle, d.Level));
+                GL.FramebufferTexture(ft, fa, d.Texture.Handle, d.Level));
         }

         public void AttachTextureImage(Context currentContext, FramebufferAttachmentPoint attachmentPoint, Texture2DArray texture, int level, int layer)
@@ -212,7 +212,7 @@
             };

             Attach(currentContext, attachmentPoint, ref newDesc, (FramebufferTarget ft, FramebufferAttachment fa, ref FramebufferAttachmentDescription d) =>
-                GL.FramebufferTexture2D(ft, fa, d.TextureTarget, d.Texture.Handle, 0));
+                GL.FramebufferTexture(ft, fa, d.Texture.Handle, 0));
         }

         public void AttachTextureImage(Context currentContext, FramebufferAttachmentPoint attachmentPoint, Texture2DMultisampleArray texture, int layer)


[Direct3D11] Add extra methods to retrieve dx11.3 feature options from graphics driver

--- Source/SharpDX.Direct3D11/Device.cs
+++ Source/SharpDX.Direct3D11/Device.cs
@@ -380,6 +380,38 @@
         }

         /// <summary>
+        /// Retrieves information about Direct3D11.3 feature options in the current graphics driver
+        /// </summary>
+        /// <msdn-id>dn879499</msdn-id>
+        /// <returns>Returns a structure <see cref="FeatureDataD3D11Options2"/> </returns>
+        public FeatureDataD3D11Options2 CheckD3D113Features2()
+        {
+            unsafe
+            {
+                var support = default(FeatureDataD3D11Options2);
+                if (CheckFeatureSupport(Feature.D3D11Options2, new IntPtr(&support), Utilities.SizeOf<FeatureDataD3D11Options2>()).Failure)
+                    return default(FeatureDataD3D11Options2);
+                return support;
+            }
+        }
+
+        /// <summary>
+        /// Retrieves additional information about Direct3D11.3 feature options in the current graphics driver
+        /// </summary>
+        /// <msdn-id>dn933226</msdn-id>
+        /// <returns>Returns a structure <see cref="FeatureDataD3D11Options3"/> </returns>
+        public FeatureDataD3D11Options3 CheckD3D113Features3()
+        {
+            unsafe
+            {
+                var support = default(FeatureDataD3D11Options3);
+                if (CheckFeatureSupport(Feature.D3D11Options3, new IntPtr(&support), Utilities.SizeOf<FeatureDataD3D11Options3>()).Failure)
+                    return default(FeatureDataD3D11Options3);
+                return support;
+            }
+        }
+
+        /// <summary>
         /// Check if this device is supporting a feature.
         /// </summary>
         /// <param name="feature">The feature to check.</param>


Added Controller.GetCapabilities() which matches the GetState(out) overload.

--- Source/SharpDX.XInput/Controller.cs
+++ Source/SharpDX.XInput/Controller.cs
@@ -70,6 +70,17 @@
             var result = ErrorCodeHelper.ToResult(XInput.XInputGetCapabilities((int)userIndex, deviceQueryType, out temp));
             result.CheckError();
             return temp;
+        }
+
+        /// <summary>
+        /// Gets the capabilities.
+        /// </summary>
+        /// <param name="deviceQueryType">Type of the device query.</param>
+        /// <param name="capabilities">The capabilities of this controller.</param>
+        /// <returns><c>true</c> if the controller is connected, <c>false</c> otherwise.</returns>
+        public bool GetCapabilities(DeviceQueryType deviceQueryType, out Capabilities capabilities)
+        {
+            return XInput.XInputGetCapabilities((int)userIndex, deviceQueryType, out capabilities) == 0;
         }

         /// <summary>


自动性能优化

自动性能优化

--- StaticExtensionBenchmark/Program.cs
+++ StaticExtensionBenchmark/Program.cs
@@ -52,7 +52,7 @@
         [ArgumentsSource(nameof(GetTime))]
         public object GetFieldWithCache(object[] getObjectTimeList)
         {
-            var creatorDictionary = new Dictionary<(Type type, string name), Func<object>>();
+            var creatorDictionary = new Dictionary<(Type type, string name), IFieldOrPropertyValueGetter>();
             for (var i = 0; i < getObjectTimeList.Length; i++)
             {
                 GetFieldOrPropertyValueWithCache(typeof(Foo), "Field", out var value, creatorDictionary);
@@ -67,7 +67,7 @@
         [ArgumentsSource(nameof(GetTime))]
         public object GetPropertyWithCache(object[] getObjectTimeList)
         {
-            var creatorDictionary = new Dictionary<(Type type, string name), Func<object>>();
+            var creatorDictionary = new Dictionary<(Type type, string name), IFieldOrPropertyValueGetter>();
             for (var i = 0; i < getObjectTimeList.Length; i++)
             {
                 GetFieldOrPropertyValueWithCache(typeof(Foo), "Property", out var value, creatorDictionary);
@@ -110,7 +110,7 @@
         {
             foreach (var count in GetTimeInner())
             {
-                yield return new object[]{ new object[count] };
+                yield return new object[] {new object[count]};
             }

             IEnumerable<int> GetTimeInner()
@@ -123,8 +123,43 @@
             }
         }

+        interface IFieldOrPropertyValueGetter
+        {
+            object GetObject();
+        }
+
+        class FieldValueGetter : IFieldOrPropertyValueGetter
+        {
+            public FieldValueGetter(FieldInfo fieldInfo)
+            {
+                _fieldInfo = fieldInfo;
+            }
+
+            public object GetObject()
+            {
+                return _fieldInfo.GetValue(null);
+            }
+
+            private readonly FieldInfo _fieldInfo;
+        }
+
+        class PropertyValueGetter : IFieldOrPropertyValueGetter
+        {
+            public PropertyValueGetter(PropertyInfo propertyInfo)
+            {
+                _propertyInfo = propertyInfo;
+            }
+
+            public object GetObject()
+            {
+                return _propertyInfo.GetValue(null, null);
+            }
+
+            private readonly PropertyInfo _propertyInfo;
+        }
+
         private bool GetFieldOrPropertyValueWithCache(Type type, string name, out object value,
-            Dictionary<(Type type, string name), Func<object>> creatorDictionary)
+            Dictionary<(Type type, string name), IFieldOrPropertyValueGetter> creatorDictionary)
         {
             if (!creatorDictionary.TryGetValue((type, name), out var creator))
             {
@@ -134,7 +169,7 @@

             if (creator != null)
             {
-                value = creator();
+                value = creator.GetObject();
                 return true;
             }
             else
@@ -144,7 +179,7 @@
             }
         }

-        private Func<object> GetCreator(Type type, string name)
+        private IFieldOrPropertyValueGetter GetCreator(Type type, string name)
         {
             FieldInfo field = null;
             Type temp = type;
@@ -154,7 +189,7 @@
                 field = temp.GetField(name, BindingFlags.Public | BindingFlags.Static);
                 if (field != null)
                 {
-                    return () => field.GetValue(null);
+                    return new FieldValueGetter(field);
                 }

                 temp = temp.BaseType;
@@ -169,7 +204,7 @@
                 prop = temp.GetProperty(name, BindingFlags.Public | BindingFlags.Static);
                 if (prop != null)
                 {
-                    return () => prop.GetValue(null, null);
+                    return new PropertyValueGetter(prop);
                 }

                 temp = temp.BaseType;
@@ -177,9 +212,6 @@

             return null;
         }
-
-        private Dictionary<(Type type, string name), Func<object>> CreatorDictionary { get; } =
-            new Dictionary<(Type type, string name), Func<object>>();

         private bool GetFieldOrPropertyValue(Type type, string name, out object value)
         {


Tune timeout values

Tune timeout values

--- cli/test/MsgPack.UnitTest/DirectConversionTest.cs
+++ cli/test/MsgPack.UnitTest/DirectConversionTest.cs
@@ -28,7 +28,7 @@
 namespace MsgPack
 {
 	[TestFixture]
-	[Timeout( 1000 )]
+	[Timeout( 5000 )]
 	public partial class DirectConversionTest
 	{
 		[Test]
@@ -226,7 +226,7 @@
 		}

 		[Test]
-		[Timeout( 3000 )]
+		[Timeout( 10000 )]
 		public void TestMap()
 		{
 			var emptyMap = new Dictionary<int, int>();


Add Parameter.Index property

Add Parameter.Index property

--- src/DotNet/ParameterList.cs
+++ src/DotNet/ParameterList.cs
@@ -182,6 +182,13 @@
 		}

 		/// <summary>
+		/// Gets the parameter index. <see cref="Number"/>
+		/// </summary>
+		public int Index {
+			get { return Number; }
+		}
+
+		/// <summary>
 		/// Gets the index of the parameter in the method signature. It's -1 if it's the hidden
 		/// 'this' parameter.
 		/// </summary>


Update TokenCompareTo()

Update TokenCompareTo()

--- src/DotNet/PublicKeyBase.cs
+++ src/DotNet/PublicKeyBase.cs
@@ -95,6 +95,7 @@
 			return TokenCompareTo(a, b) == 0;
 		}

+		static readonly byte[] EmptyByteArray = new byte[0];
 		/// <summary>
 		/// Compares two <see cref="PublicKeyToken"/>s
 		/// </summary>
@@ -104,7 +105,11 @@
 		public static int TokenCompareTo(PublicKeyToken a, PublicKeyToken b) {
 			if (a == b)
 				return 0;
-			return Utils.CompareTo(a == null ? null : a.data, b == null ? null : b.data);
+			return TokenCompareTo(a == null ? null : a.data, b == null ? null : b.data);
+		}
+
+		static int TokenCompareTo(byte[] a, byte[] b) {
+			return Utils.CompareTo(a ?? EmptyByteArray, b ?? EmptyByteArray);
 		}

 		/// <summary>


Fix build issue

Fix build issue

--- kafka-sharp/kafka-sharp.UTest/TestConnection.cs
+++ kafka-sharp/kafka-sharp.UTest/TestConnection.cs
@@ -599,7 +599,11 @@
                 {
                     if (te.InnerException is SocketException se)
                     {
+#if NET_CORE
+                        if (se.SocketErrorCode == (int)SocketError.Success)
+#else
                         if (se.ErrorCode == (int)SocketError.Success)
+#endif
                         {
                             numberOfConnectionError++;
                         }


EH ja

EH ja

--- kode/SysUt14Gr03/SysUt14Gr03/VisOppgave.aspx.cs
+++ kode/SysUt14Gr03/SysUt14Gr03/VisOppgave.aspx.cs
@@ -129,6 +129,7 @@

                     // Gi tilbakemelding
                 }
+                Response.Redirect(Request.RawUrl);

             }
         }


BufferValueReader exposes buffer like the Writer

--- BufferValueReader.cs
+++ BufferValueReader.cs
@@ -47,6 +47,11 @@
 			this.length = length;
 		}

+		public byte[] Buffer
+		{
+			get { return this.buffer; }
+		}
+
 		public int Position
 		{
 			get;


tests

tests

--- src/EditorFeatures/CSharpTest/Completion/CompletionProviders/Snippets/CSharpIfSnippetCompletionProviderTests.cs
+++ src/EditorFeatures/CSharpTest/Completion/CompletionProviders/Snippets/CSharpIfSnippetCompletionProviderTests.cs
@@ -56,5 +56,308 @@
 ";
             await VerifyCustomCommitProviderAsync(markupBeforeCommit, s_itemToCommit, expectedCodeAfterCommit);
         }
+
+        [WpfFact, Trait(Traits.Feature, Traits.Features.Completion)]
+        public async Task NoIfSnippetInBlockNamespaceTest()
+        {
+            var markupBeforeCommit =
+@"
+namespace Namespace
+{
+    $$
+    class Program
+    {
+        public async Task MethodAsync()
+        {
+        }
+    }
+}";
+            await VerifyItemIsAbsentAsync(markupBeforeCommit, s_itemToCommit);
+        }
+
+        [WpfFact, Trait(Traits.Feature, Traits.Features.Completion)]
+        public async Task NoIfSnippetInFileScopedNamespaceTest()
+        {
+            var markupBeforeCommit =
+@"
+namespace Namespace;
+$$
+class Program
+{
+    public async Task MethodAsync()
+    {
     }
 }
+";
+            await VerifyItemIsAbsentAsync(markupBeforeCommit, s_itemToCommit);
+        }
+
+        [WpfFact, Trait(Traits.Feature, Traits.Features.Completion)]
+        public async Task InsertIfSnippetInConstructorTest()
+        {
+            var markupBeforeCommit =
+@"class Program
+{
+    public Program()
+    {
+        var x = 5;
+        $$
+    }
+}";
+
+            var expectedCodeAfterCommit =
+@"class Program
+{
+    public Program()
+    {
+        var x = 5;
+        if ($$true) { }
+    }
+}";
+            await VerifyCustomCommitProviderAsync(markupBeforeCommit, s_itemToCommit, expectedCodeAfterCommit);
+        }
+
+        [WpfFact, Trait(Traits.Feature, Traits.Features.Completion)]
+        public async Task InsertIfSnippettInLocalFunctionTest()
+        {
+            var markupBeforeCommit =
+@"class Program
+{
+    public void Method()
+    {
+        var x = 5;
+        void LocalMethod()
+        {
+            $$
+        }
+    }
+}";
+
+            var expectedCodeAfterCommit =
+@"class Program
+{
+    public void Method()
+    {
+        var x = 5;
+        void LocalMethod()
+        {
+            if ($$true) { }
+        }
+    }
+}";
+            await VerifyCustomCommitProviderAsync(markupBeforeCommit, s_itemToCommit, expectedCodeAfterCommit);
+        }
+
+        [WpfFact, Trait(Traits.Feature, Traits.Features.Completion)]
+        public async Task InsertIfSnippetInAnonymousFunctionTest()
+        {
+            var markupBeforeCommit =
+@"public delegate void Print(int value);
+
+static void Main(string[] args)
+{
+    Print print = delegate(int val) {
+        $$
+    };
+
+}";
+
+            var expectedCodeAfterCommit =
+@"public delegate void Print(int value);
+
+static void Main(string[] args)
+{
+    Print print = delegate(int val) {
+        if ($$true) { }
+    };
+
+}";
+            await VerifyCustomCommitProviderAsync(markupBeforeCommit, s_itemToCommit, expectedCodeAfterCommit);
+        }
+
+        [WpfFact, Trait(Traits.Feature, Traits.Features.Completion)]
+        public async Task InsertIfSnippetInParenthesizedLambdaExpressionTest()
+        {
+            var markupBeforeCommit =
+@"Func<int, int, bool> testForEquality = (x, y) =>
+{
+    $$
+    return x == y;
+};";
+
+            var expectedCodeAfterCommit =
+@"Func<int, int, bool> testForEquality = (x, y) =>
+{
+    if ($$true) { }
+    return x == y;
+};";
+            await VerifyCustomCommitProviderAsync(markupBeforeCommit, s_itemToCommit, expectedCodeAfterCommit);
+        }
+
+        [WpfFact, Trait(Traits.Feature, Traits.Features.Completion)]
+        public async Task NoIfSnippetInSwitchExpression()
+        {
+            var markupBeforeCommit =
+@"class Program
+{
+    public void Method()
+    {
+       var operation = 2;
+
+        var result = operation switch
+        {
+            $$
+            1 => ""Case 1"",
+            2 => ""Case 2"",
+            3 => ""Case 3"",
+            4 => ""Case 4"",
+        };
+    }
+}";
+            await VerifyItemIsAbsentAsync(markupBeforeCommit, s_itemToCommit);
+        }
+
+        [WpfFact, Trait(Traits.Feature, Traits.Features.Completion)]
+        public async Task NoIfSnippetInSingleLambdaExpression()
+        {
+            var markupBeforeCommit =
+@"class Program
+{
+    public void Method()
+    {
+       Func<int, int> f = x => $$;
+    }
+}";
+            await VerifyItemIsAbsentAsync(markupBeforeCommit, s_itemToCommit);
+        }
+
+        [WpfFact, Trait(Traits.Feature, Traits.Features.Completion)]
+        public async Task NoIfSnippetInStringTest()
+        {
+            var markupBeforeCommit =
+@"class Program
+{
+    public void Method()
+    {
+        var str = ""$$"";
+    }
+}";
+
+            await VerifyItemIsAbsentAsync(markupBeforeCommit, s_itemToCommit);
+        }
+
+        [WpfFact, Trait(Traits.Feature, Traits.Features.Completion)]
+        public async Task NoIfSnippetInObjectInitializerTest()
+        {
+            var markupBeforeCommit =
+@"class Program
+{
+    public void Method()
+    {
+        var str = new Test($$);
+    }
+}
+
+class Test
+{
+    private string val;
+
+    public Test(string val)
+    {
+        this.val = val;
+    }
+}";
+
+            await VerifyItemIsAbsentAsync(markupBeforeCommit, s_itemToCommit);
+        }
+
+        [WpfFact, Trait(Traits.Feature, Traits.Features.Completion)]
+        public async Task NoIfSnippetInParameterListTest()
+        {
+            var markupBeforeCommit =
+@"class Program
+{
+    public void Method(int x, $$)
+    {
+    }
+}";
+
+            await VerifyItemIsAbsentAsync(markupBeforeCommit, s_itemToCommit);
+        }
+
+        [WpfFact, Trait(Traits.Feature, Traits.Features.Completion)]
+        public async Task NoIfSnippetInRecordDeclarationTest()
+        {
+            var markupBeforeCommit =
+@"public record Person
+{
+    $$
+    public string FirstName { get; init; } = default!;
+    public string LastName { get; init; } = default!;
+};";
+
+            await VerifyItemIsAbsentAsync(markupBeforeCommit, s_itemToCommit);
+        }
+
+        [WpfFact, Trait(Traits.Feature, Traits.Features.Completion)]
+        public async Task NoIfSnippetInVariableDeclarationTest()
+        {
+            var markupBeforeCommit =
+@"class Program
+{
+    public void Method()
+    {
+        var x = $$
+    }
+}";
+
+            await VerifyItemIsAbsentAsync(markupBeforeCommit, s_itemToCommit);
+        }
+
+        [WpfFact, Trait(Traits.Feature, Traits.Features.Completion)]
+        public async Task InsertIfSnippetWithInvocationBeforeAndAfterCursorTest()
+        {
+            var markupBeforeCommit =
+@"class Program
+{
+    public void Method()
+    {
+        Wr$$Blah
+    }
+}";
+
+            var expectedCodeAfterCommit =
+@"class Program
+{
+    public void Method()
+    {
+        if ($$true) { }
+    }
+}";
+            await VerifyCustomCommitProviderAsync(markupBeforeCommit, s_itemToCommit, expectedCodeAfterCommit);
+        }
+
+        [WpfFact, Trait(Traits.Feature, Traits.Features.Completion)]
+        public async Task InsertIfSnippetWithInvocationUnderscoreBeforeAndAfterCursorTest()
+        {
+            var markupBeforeCommit =
+@"class Program
+{
+    public void Method()
+    {
+        _Wr$$Blah_
+    }
+}";
+
+            var expectedCodeAfterCommit =
+@"class Program
+{
+    public void Method()
+    {
+        if ($$true) { }
+    }
+}";
+            await VerifyCustomCommitProviderAsync(markupBeforeCommit, s_itemToCommit, expectedCodeAfterCommit);
+        }
+    }
+}


Fixed BufferedPeekWireStreamReaderAsync

Fixed BufferedPeekWireStreamReaderAsync

--- src/FreecraftCore.Serializer.Stream/Read/Decorators/async/BufferedPeekWireStreamReaderStrategyDecoratorAsync.cs
+++ src/FreecraftCore.Serializer.Stream/Read/Decorators/async/BufferedPeekWireStreamReaderStrategyDecoratorAsync.cs
@@ -17,140 +17,119 @@
 		}

 		/// <inheritdoc />
-		public Task<byte> ReadByteAsync()
+		public async Task<byte> ReadByteAsync()
 		{
 			if (ReaderState == State.Default)
-				return DecoratedReader.ReadByteAsync();
+				return await DecoratedReader.ReadByteAsync();
 			else
 			{
-				return new Task<byte>(() =>
+				byte b = BufferedBytes.First();
+
+				BufferedCount--;
+
+				//Reset the LINQ filled enumerable if it's empty
+				//If it's not then we use a skip
+				if (BufferedCount == 0)
 				{
-					byte b = BufferedBytes.First();
+					ReaderState = State.Default;
+					BufferedBytes = Enumerable.Empty<byte>();
+				}
+				else
+					BufferedBytes = BufferedBytes.Skip(1);

-					BufferedCount--;
-
-					//Reset the LINQ filled enumerable if it's empty
-					//If it's not then we use a skip
-					if (BufferedCount == 0)
-					{
-						ReaderState = State.Default;
-						BufferedBytes = Enumerable.Empty<byte>();
-					}
-					else
-						BufferedBytes = BufferedBytes.Skip(1);
-
-					return b;
-				});
+				return b;
 			}
 		}

 		/// <inheritdoc />
-		public Task<byte> PeekByteAsync()
+		public async Task<byte> PeekByteAsync()
 		{
 			//More efficient to get the byte array
 			//We need to buffer it anyway
-			Task<byte[]> bytes = ReadBytesAsync(1);
+			byte[] bytes = await ReadBytesAsync(1);

-			return new Task<byte>(() =>
-			{
-				//Don't set peek until AFTER read. We may need to peek into buffered but we may not to.
-				//We avoid messing with the state until after the read.
-				ReaderState = State.Peeked;
+			//Don't set peek until AFTER read. We may need to peek into buffered but we may not to.
+			//We avoid messing with the state until after the read.
+			ReaderState = State.Peeked;

-				//When we peek we must buffer the results.
-				BufferedBytes = BufferedBytes.Concat(bytes.Result);
+			//When we peek we must buffer the results.
+			BufferedBytes = BufferedBytes.Concat(bytes);

-				BufferedCount++;
+			BufferedCount++;

-				return bytes.Result.First();
-			});
+			return bytes[0];
 		}

 		/// <inheritdoc />
-		public Task<byte[]> ReadAllBytesAsync()
+		public async Task<byte[]> ReadAllBytesAsync()
 		{
 			if (ReaderState == State.Default)
-				return DecoratedReader.ReadAllBytesAsync();
+				return await DecoratedReader.ReadAllBytesAsync();
 			else
 			{
 				//Make sure to read outside the return task
-				Task<byte[]> bytes = DecoratedReader.ReadAllBytesAsync();
+				byte[] bytes = await DecoratedReader.ReadAllBytesAsync();

-				return new Task<byte[]>(() =>
-				{
-					ReaderState = State.Default;
-					BufferedCount = 0;
+				ReaderState = State.Default;
+				BufferedCount = 0;

-					byte[] array = BufferedBytes.Concat(new EnumerableAsyncBytes(bytes)).ToArray();
-					BufferedBytes = Enumerable.Empty<byte>();
-					return array;
-				});
+				byte[] array = BufferedBytes.Concat(bytes).ToArray();
+				BufferedBytes = Enumerable.Empty<byte>();
+				return array;
 			}
 		}

 		/// <inheritdoc />
-		public Task<byte[]> ReadBytesAsync(int count)
+		public async Task<byte[]> ReadBytesAsync(int count)
 		{
 			if (ReaderState == State.Default)
-				return DecoratedReader.ReadBytesAsync(count);
+				return await DecoratedReader.ReadBytesAsync(count);
 			else
 			{
-				Task<byte[]> bytes = null;
+				byte[] bytes = null;

 				if (count == BufferedCount)
-					bytes = new Task<byte[]>(() => BufferedBytes.ToArray());
+					bytes = BufferedBytes.ToArray();
 				else if (count < BufferedCount)
 				{
-					bytes = new Task<byte[]>(() =>
-					{
-						byte[] lambdaBytes = BufferedBytes.Take(count).ToArray();
+					bytes = BufferedBytes.Take(count).ToArray();

-						//Skip the amount pulled out
-						BufferedBytes = BufferedBytes.Skip(count);
-
-						return lambdaBytes;
-					});
+					//Skip the amount pulled out
+					BufferedBytes = BufferedBytes.Skip(count);
 				}
 				else
 				{
-					Task<byte[]> asyncBytes = DecoratedReader.ReadBytesAsync(count - BufferedCount);
+					byte[] streamReadBytes = await DecoratedReader.ReadBytesAsync(count - BufferedCount);

-					bytes = new Task<byte[]>(() => BufferedBytes.Concat(new EnumerableAsyncBytes(asyncBytes)).ToArray());
+					bytes = BufferedBytes.Concat(streamReadBytes).ToArray();
 				}

-				//Setup a continuation to handle the buffered stuff
-				return new Task<byte[]>(() =>
+				//Set the new size of the buffered byte chunk
+				BufferedCount = Math.Max(0, BufferedCount - count);
+
+				if (BufferedCount == 0)
 				{
-					//Set the new size of the buffered byte chunk
-					BufferedCount = Math.Max(0, BufferedCount - count);
-
-					if (BufferedCount == 0)
-					{
-						ReaderState = State.Default;
-						BufferedBytes = Enumerable.Empty<byte>();
-					}
-					return bytes.Result;
-				});
+					ReaderState = State.Default;
+					BufferedBytes = Enumerable.Empty<byte>();
+				}
+				return bytes;
 			}
 		}

 		/// <inheritdoc />
-		public Task<byte[]> PeakBytesAsync(int count)
+		public async Task<byte[]> PeakBytesAsync(int count)
 		{
 			//When we peek we must buffer the results.
-			Task<byte[]> bytes = ReadBytesAsync(count);
+			byte[] bytes = await ReadBytesAsync(count);

-			return new Task<byte[]>(() =>
-			{
-				//Don't set peek until AFTER read. We may need to peek into buffered but we may not to.
-				//We avoid messing with the state until after the read.
-				ReaderState = State.Peeked;
+			//Don't set peek until AFTER read. We may need to peek into buffered but we may not to.
+			//We avoid messing with the state until after the read.
+			ReaderState = State.Peeked;

-				BufferedBytes = BufferedBytes.Concat(new EnumerableAsyncBytes(bytes));
-				BufferedCount += bytes.Result.Length;
+			BufferedBytes = BufferedBytes.Concat(bytes);
+			BufferedCount += bytes.Length;

-				return bytes.Result;
-			});
+			return bytes;
 		}
 	}
 }


Removed notes from Program.cs

Removed notes from Program.cs

--- src/GraphClimber/Program.cs
+++ src/GraphClimber/Program.cs
@@ -41,20 +41,8 @@
             var stream = new MemoryStream();
             var binaryWriterProcessor = new BinaryWriterProcessor(new SuperBinaryWriter(stream));

-            // Not that good :( :
-            // I need the field to be "object" and not the struct "Person2"
-            //writeClimber.Route(person, binaryWriterProcessor);
-            StrongBox<object> strongBox2 =
-                new StrongBox<object>()
-                {
-                    Value = person
-                };
-
-            var stateMember = new StaticStateMember(person);
+            writeClimber.Route(person, binaryWriterProcessor, false);

-            writeClimber.Route(person, binaryWriterProcessor, false);
-            //new ReflectionValueDescriptor<Person2, Person2>(binaryWriterProcessor, stateMemberProvider, stateMember, null).Route(stateMember, person.GetType(), null);
-
             stream.Position = 0;
             var binaryReaderProcessor = new BinaryReaderProcessor(new SuperBinaryReader(stream));


Added ability to animate working MagneticDamper with an IAnimator module

--- Modules/ATMagneticDamper.cs
+++ Modules/ATMagneticDamper.cs
@@ -41,6 +41,8 @@

         [KSPField(isPersistant = true)] public bool damperEnabled = true;
         [KSPField(isPersistant = true)] public bool magnetEnabled = true;
+        [KSPField] public string AnimatorID = string.Empty;
+        private IAnimator animator;
         protected Damper damper;
         protected ResourcePump socket;

@@ -85,6 +87,11 @@
                     damper.Init(this);
                     damper.enabled = damperEnabled;
                     socket = part.CreateSocket();
+                    animator = part.GetAnimator(AnimatorID);
+                    if(damperEnabled)
+                        animator?.Open();
+                    else
+                        animator?.Close();
                     HasDamper = true;
                 }
             }
@@ -118,6 +125,7 @@
                 return;
             if(socket.PartialTransfer)
             {
+                animator?.Close();
                 damper.enabled = false;
                 reactivateAtUT = Planetarium.GetUniversalTime() + ReactivateAfterSeconds;
                 Utils.Message(ReactivateAfterSeconds,
@@ -134,6 +142,7 @@
                && !damper.enabled
                && Planetarium.GetUniversalTime() > reactivateAtUT)
             {
+                animator?.Open();
                 damper.enabled = true;
                 Utils.Message($"[{part.Title()}] Damper reactivated"); //debug
             }
@@ -154,6 +163,10 @@
             if(!HasDamper || enable == damperEnabled)
                 return;
             damper.enabled = damperEnabled = enable;
+            if(damperEnabled)
+                animator?.Open();
+            else
+                animator?.Close();
             updatePAW();
         }


MMILCursor.FindNext/Prev now only add successfully located cursors to the output array

--- MonoMod.Utils/MMILCursor.cs
+++ MonoMod.Utils/MMILCursor.cs
@@ -329,11 +329,13 @@
         /// <returns>True if a match was found</returns>
         public bool TryFindNext(out MMILCursor[] cursors, params Func<Instruction, bool>[] predicates) {
             cursors = new MMILCursor[predicates.Length];
+            MMILCursor c = this;
             for (int i = 0; i < predicates.Length; i++) {
-                cursors[i] = (i == 0 ? this : cursors[i-1]).Clone();
-
-                if (!cursors[i].TryGotoNext(predicates[i]))
+                c = c.Clone();
+                if (!c.TryGotoNext(predicates[i]))
                     return false;
+
+                cursors[i] = c;
             }
             return true;
         }
@@ -355,11 +357,13 @@
         /// <returns>True if a match was found</returns>
         public bool TryFindPrev(out MMILCursor[] cursors, params Func<Instruction, bool>[] predicates) {
             cursors = new MMILCursor[predicates.Length];
+            MMILCursor c = this;
             for (int i = predicates.Length - 1; i >= 0; i--) {
-                cursors[i] = (i+1 == predicates.Length ? this : cursors[i + 1]).Clone();
-
-                if (!cursors[i].TryGotoPrev(predicates[i]))
+                c = c.Clone();
+                if (!c.TryGotoPrev(predicates[i]))
                     return false;
+
+                cursors[i] = c;
             }
             return true;
         }


Update SendDataHandler.cs

Update SendDataHandler.cs

added optional json return type

--- src/formulate.app/Forms/Handlers/SendData/SendDataHandler.cs
+++ src/formulate.app/Forms/Handlers/SendData/SendDataHandler.cs
@@ -1,4 +1,4 @@
-namespace formulate.app.Forms.Handlers.SendData
+namespace formulate.app.Forms.Handlers.SendData
 {

     // Namespaces.
@@ -324,6 +324,7 @@
                 ? $"{bareUrl}?{strQueryString}"
                 : config.Url;
             var enableLogging = WebConfigurationManager.AppSettings["Formulate:EnableLogging"];
+            var returnJsonObject = WebConfigurationManager.AppSettings["Formulate:ReturnOuterJsonObject"];

             // Attempt to send the web request.
@@ -369,8 +370,10 @@
                             Value = x.Select(y => y.Value)
                         }).ToDictionary(x => x.Key,
                             x => x.Value.Count() > 1 ? x.Value.ToArray() as object : x.Value.FirstOrDefault());
-                        var json = JsonConvert.SerializeObject(new[] { grouped });
-
+
+                        var json = returnJsonObject == "true" ?
+                            JsonConvert.SerializeObject(grouped) :
+                            JsonConvert.SerializeObject(new[] { grouped });

                         // Log JSON being sent.
                         if (enableLogging == "true")
@@ -468,4 +471,4 @@

     }

-}+}


为 StorageBucketInfo 类添加默认无参数构造函数。

为 StorageBucketInfo 类添加默认无参数构造函数。

--- src/IO/StorageBucketInfo.cs
+++ src/IO/StorageBucketInfo.cs
@@ -48,6 +48,11 @@
 		#endregion

 		#region 构造函数
+		public StorageBucketInfo()
+		{
+			_createdTime = DateTime.Now;
+		}
+
 		public StorageBucketInfo(int bucketId)
 		{
 			_createdTime = DateTime.Now;


use the part launch time to calculate age

--- src/Kerbalism/Background.cs
+++ src/Kerbalism/Background.cs
@@ -190,7 +190,7 @@
 				Vector3d dir = panel.isTracking ? tr.up : tr.forward;
 				dir = (v.transform.rotation * p.rotation * dir).normalized;

-				float age = (float)(v.missionTime / (Lib.HoursInDay() * 3600));
+				float age = (float)((Planetarium.GetUniversalTime() - panel.launchUT) / (Lib.HoursInDay() * 3600));
 				float effic_factor = panel.timeEfficCurve != null ? panel.timeEfficCurve.Evaluate(age) : 1.0f;

 				// calculate cosine factor


New delete property to mark entity as deleteable.

Adjusted to refactored registrar.
Changed dbsession.

--- src/Micro+/Entity/Entity.cs
+++ src/Micro+/Entity/Entity.cs
@@ -5,13 +5,14 @@
 {
     public abstract class Entity
     {
-        internal IEntitySession EntitySession { get; set; }
+        internal IDbSession EntitySession { get; set; }
+        public bool Delete { get; set; }

         public Entity()
         {
-            string connectionString = ConnectionStringRegistrar.GetFor(this.GetType());
-            DbEngine dbEngine = DbEngineRegistrar.GetFor(this.GetType());
-            this.EntitySession = new EntitySession(connectionString, dbEngine);
+            string connectionString = Registrar<string>.GetFor(this.GetType());
+            DbEngine dbEngine = Registrar<DbEngine>.GetFor(this.GetType());
+            this.EntitySession = new DbSession(connectionString, dbEngine);
         }
     }
 }


fix parameter name of partitionerId in MockSparkContextProxy.cs

--- csharp/AdapterTest/Mocks/MockSparkContextProxy.cs
+++ csharp/AdapterTest/Mocks/MockSparkContextProxy.cs
@@ -84,7 +84,7 @@
             }
         }

-        public IRDDProxy CreatePairwiseRDD(IRDDProxy javaReferenceInByteArrayRdd, int numPartitions, long partitionerId)
+        public IRDDProxy CreatePairwiseRDD(IRDDProxy javaReferenceInByteArrayRdd, int numPartitions, long partitionFuncId)
         {
             return javaReferenceInByteArrayRdd;
         }