Ignore flaky exception tests

Ignore flaky exception tests

--- src/Tests/ClientConcepts/Exceptions/ExceptionTests.cs
+++ src/Tests/ClientConcepts/Exceptions/ExceptionTests.cs
@@ -19,14 +19,14 @@
 			_port = cluster.Node.Port;
 		}

-		[I]
+		//[I]
 		public void ServerTestWhenThrowExceptionsEnabled()
 		{
 			var settings = new ConnectionSettings(new Uri($"http://{TestClient.Host}:{_port}"))
 				.ThrowExceptions();
 			var client = new ElasticClient(settings);
 			var exception = Assert.Throws<ElasticsearchClientException>(() => client.GetMapping<Project>(s => s.Index("doesntexist")));
-#if DOTNETCORE
+#if DOTNETCORE
 			// HttpClient does not throw on "known error" status codes (i.e. 404) thus the inner exception should not be set
 			exception.InnerException.Should().BeNull();
 #else
@@ -37,7 +37,7 @@
 			exception.Response.ServerError.Status.Should().BeGreaterThan(0);
 		}

-		[I]
+		//[I]
 		public void ClientTestWhenThrowExceptionsEnabled()
 		{
 			var settings = new ConnectionSettings(new Uri("http://doesntexist:9200"))
@@ -53,23 +53,23 @@
 #endif
 		}

-		[I]
+		//[I]
 		public void ServerTestWhenThrowExceptionsDisabled()
 		{
 			var settings = new ConnectionSettings(new Uri($"http://{TestClient.Host}:{_port}"));
 			var client = new ElasticClient(settings);
 			var response = client.GetMapping<Project>(s => s.Index("doesntexist"));
-#if DOTNETCORE
+#if DOTNETCORE
 			// HttpClient does not throw on "known error" status codes (i.e. 404) thus OriginalException should not be set
 			response.CallDetails.OriginalException.Should().BeNull();
-#else
+#else
 			response.CallDetails.OriginalException.Should().NotBeNull();
 #endif
 			response.CallDetails.ServerError.Should().NotBeNull();
 			response.CallDetails.ServerError.Status.Should().BeGreaterThan(0);
 		}

-		[I]
+		//[I]
 		public void ClientTestWhenThrowExceptionsDisabled()
 		{
 			var settings = new ConnectionSettings(new Uri("http://doesntexist:9200"));
@@ -89,7 +89,7 @@
 		{
 			var settings = new ConnectionSettings(new Uri("http://doesntexist:9200"));
 			var client = new ElasticClient(settings);
-
+
 			Action dispatch = () => client.Index(new Project());
 			var ce = dispatch.ShouldThrow<ArgumentException>();
 			ce.Should().NotBeNull();


Fixes: U4-3911 Datatypes changes their uniqueID on first save

--- src/Umbraco.Web/Models/Mapping/DataTypeModelMapper.cs
+++ src/Umbraco.Web/Models/Mapping/DataTypeModelMapper.cs
@@ -39,10 +39,13 @@
                       {
                           var resolver = new PreValueDisplayResolver(lazyDataTypeService);
                           return resolver.Convert(definition);
-                      });
+                      });

             config.CreateMap<DataTypeSave, IDataTypeDefinition>()
                   .ConstructUsing(save => new DataTypeDefinition(-1, save.SelectedEditor) {CreateDate = DateTime.Now})
+                //we have to ignore the Key otherwise this will reset the UniqueId field which should never change!
+                // http://issues.umbraco.org/issue/U4-3911
+                  .ForMember(definition => definition.Key, expression => expression.Ignore())
                   .ForMember(definition => definition.Path, expression => expression.Ignore())
                   .ForMember(definition => definition.PropertyEditorAlias, expression => expression.MapFrom(save => save.SelectedEditor))
                   .ForMember(definition => definition.ParentId, expression => expression.MapFrom(save => -1))


Fixed: Track list adding order

Fixed: Track list adding order

--- src/YTMusicDownloader/ViewModel/WorkspaceViewModel.cs
+++ src/YTMusicDownloader/ViewModel/WorkspaceViewModel.cs
@@ -658,9 +658,10 @@
             if (Tracks.Count == 0)
                 addItems.Reverse();

+
             // Add the new items
             foreach (var item in addItems)
-                Tracks.Add(new PlaylistItemViewModel(item, this));
+                Tracks.Insert(0, new PlaylistItemViewModel(item, this));

             var i = 1;
             DownloadedTracks = 0;


[Aardvark.Base] more array extensions: Map[23](Func), including SetMap[ 23](Func), FoldLeft/Right[23]

--- src/Aardvark.Base/Extensions/ArrayExtensions.cs
+++ src/Aardvark.Base/Extensions/ArrayExtensions.cs
@@ -629,10 +629,49 @@
 			self[targetIndex] = help;
 		}

-		/// <summary>
-		/// Swap the two elements specified by their indices.
-		/// </summary>
-		public static void Swap<T>(this T[] self, int i, int j)
+
+        /// <summary>
+        /// Sets the array items to a mapped version of the items of array0.
+        /// </summary>
+        public static void SetMap<T, T0>(
+                this T[] array, T0[] array0, Func<T0, T> item0_fun)
+        {
+            var count = Fun.Min(array.LongLength, array0.LongLength);
+            for (long i = 0; i < count; i++)
+                array[i] = item0_fun(array0[i]);
+        }
+
+        /// <summary>
+        /// Sets the array items to a mapped version of corresponding
+        /// pairs of items of array0 and array1.
+        /// </summary>
+        public static void SetMap2<T, T0, T1>(
+                this T[] array, T0[] array0, T1[] array1,
+                Func<T0, T1, T> item0_item1_fun)
+        {
+            var count = Fun.Min(array.LongLength, array0.LongLength, array1.LongLength);
+            for (long i = 0; i < count; i++)
+                array[i] = item0_item1_fun(array0[i], array1[i]);
+        }
+
+        /// <summary>
+        /// Sets the array items to a mapped version of corresponding
+        /// triples of  items of array0, array1, and array2.
+        /// </summary>
+        public static void SetMap3<T, T0, T1, T2>(
+                this T[] array, T0[] array0, T1[] array1, T2[] array2,
+                Func<T0, T1, T2, T> item0_item1_item2_fun)
+        {
+            var count = Fun.Min(array.LongLength, array0.LongLength,
+                                array1.LongLength, array2.LongLength);
+            for (long i = 0; i < count; i++)
+                array[i] = item0_item1_item2_fun(array0[i], array1[i], array2[i]);
+        }
+
+        /// <summary>
+        /// Swap the two elements specified by their indices.
+        /// </summary>
+        public static void Swap<T>(this T[] self, int i, int j)
 		{
 			T help = self[i]; self[i] = self[j]; self[j] = help;
 		}
@@ -760,41 +799,81 @@
 		/// initial supplied left sum, and returns the aggregated result.
 		/// </summary>
 		public static TSum FoldLeft<TVal, TSum>(
-				this TVal[] array, TSum leftSum, Func<TSum, TVal, TSum> sum_val_addFun)
+				this TVal[] array, TSum seed, Func<TSum, TVal, TSum> sum_item_fun)
 		{
 			long count = array.LongLength;
 			for (long i = 0; i < count; i++)
-				leftSum = sum_val_addFun(leftSum, array[i]);
-			return leftSum;
-		}
-
-		/// <summary>
-		/// Performs an aggregation of all elements in an array with the
-		/// supplied aggregation function starting from the right and with the
-		/// initial supplied right sum, and returns the aggregated result.
-		/// </summary>
-		public static TSum FoldRight<TVal, TSum>(
-				this TVal[] array, Func<TVal, TSum, TSum> val_sum_addFun, TSum rightSum)
+				seed = sum_item_fun(seed, array[i]);
+			return seed;
+		}
+
+        public static TSum FoldLeft2<T0, T1, TSum>(
+                this T0[] array0, T1[] array1,
+                TSum seed, Func<TSum, T0, T1, TSum> sum_item0_item1_fun)
+        {
+            long count = Fun.Min(array0.LongLength, array1.LongLength);
+            for (long i = 0; i < count; i++)
+                seed = sum_item0_item1_fun(seed, array0[i], array1[i]);
+            return seed;
+        }
+
+        public static TSum FoldLeft3<T0, T1, T2, TSum>(
+                this T0[] array0, T1[] array1, T2[] array2,
+                TSum seed, Func<TSum, T0, T1, T2, TSum> sum_item0_item1_item2_fun)
+        {
+            long count = Fun.Min(array0.LongLength, array1.LongLength, array2.LongLength);
+            for (long i = 0; i < count; i++)
+                seed = sum_item0_item1_item2_fun(seed, array0[i], array1[i], array2[i]);
+            return seed;
+        }
+
+        /// <summary>
+        /// Performs an aggregation of all elements in an array with the
+        /// supplied aggregation function starting from the right and with the
+        /// initial supplied right sum, and returns the aggregated result.
+        /// </summary>
+        public static TSum FoldRight<TVal, TSum>(
+				this TVal[] array, Func<TVal, TSum, TSum> item_sum_fun, TSum seed)
 		{
 			long count = array.LongLength;
 			for (long i = count - 1; i >= 0; i--)
-				rightSum = val_sum_addFun(array[i], rightSum);
-			return rightSum;
-		}
-
-		/// <summary>
-		/// Performs an aggregation of the specified slice of elements in an
-		/// array with the supplied aggregation function starting from the
-		/// left and with the initial supplied left sum, and returns the
-		/// aggregated result.
-		/// </summary>
-		public static TSum FoldLeft<TVal, TSum>(
+				seed = item_sum_fun(array[i], seed);
+			return seed;
+		}
+
+        public static TSum FoldRight2<T0, T1, TSum>(
+                this T0[] array0, T1[] array1,
+                Func<T0, T1, TSum, TSum> item0_item1_sum_fun, TSum seed)
+        {
+            long count = Fun.Min(array0.LongLength, array1.LongLength);
+            for (long i = count - 1; i >= 0; i--)
+                seed = item0_item1_sum_fun(array0[i], array1[i], seed);
+            return seed;
+        }
+
+        public static TSum FoldRight3<T0, T1, T2, TSum>(
+                this T0[] array0, T1[] array1, T2[] array2,
+                Func<T0, T1, T2, TSum, TSum> item0_item1_item2_sum_fun, TSum seed)
+        {
+            long count = Fun.Min(array0.LongLength, array1.LongLength, array2.LongLength);
+            for (long i = count - 1; i >= 0; i--)
+                seed = item0_item1_item2_sum_fun(array0[i], array1[i], array2[i], seed);
+            return seed;
+        }
+
+        /// <summary>
+        /// Performs an aggregation of the specified slice of elements in an
+        /// array with the supplied aggregation function starting from the
+        /// left and with the initial supplied left sum, and returns the
+        /// aggregated result.
+        /// </summary>
+        public static TSum FoldLeft<TVal, TSum>(
 				this TVal[] array, long start, long count,
-				TSum leftSum, Func<TSum, TVal, TSum> sum_val_addFun)
+				TSum seed, Func<TSum, TVal, TSum> sum_item_fun)
 		{
 			for (long i = start, e = start + count; i < e; i++)
-				leftSum = sum_val_addFun(leftSum, array[i]);
-			return leftSum;
+				seed = sum_item_fun(seed, array[i]);
+			return seed;
 		}

 		/// <summary>
@@ -805,11 +884,11 @@
 		/// </summary>
 		public static TSum FoldRight<TVal, TSum>(
 				this TVal[] array, long start, long count,
-				Func<TVal, TSum, TSum> val_sum_addFun, TSum rightSum)
+				Func<TVal, TSum, TSum> item_sum_fun, TSum seed)
 		{
 			for (long i = start + count - 1; i >= start; i--)
-				rightSum = val_sum_addFun(array[i], rightSum);
-			return rightSum;
+				seed = item_sum_fun(array[i], seed);
+			return seed;
 		}

 		/// <summary>


Reorder using directives

Reorder using directives

--- src/Abp.Zero.Common/Zero/AbpZeroCommonModule.cs
+++ src/Abp.Zero.Common/Zero/AbpZeroCommonModule.cs
@@ -5,6 +5,7 @@
 using Abp.Authorization.Roles;
 using Abp.Authorization.Users;
 using Abp.Collections.Extensions;
+using Abp.Configuration.Startup;
 using Abp.Dependency;
 using Abp.Localization;
 using Abp.Localization.Dictionaries;
@@ -12,9 +13,8 @@
 using Abp.Modules;
 using Abp.MultiTenancy;
 using Abp.Reflection;
+using Abp.Reflection.Extensions;
 using Abp.Zero.Configuration;
-using Abp.Configuration.Startup;
-using Abp.Reflection.Extensions;
 using Castle.MicroKernel.Registration;

 namespace Abp.Zero


Added locationType for Geocode requests

Added locationType for Geocode requests

--- src/Anywhere.ArcGIS/Operation/ReverseGeocode.cs
+++ src/Anywhere.ArcGIS/Operation/ReverseGeocode.cs
@@ -39,7 +39,14 @@
         /// </summary>
         [DataMember(Name="forStorage")]
         public bool? ForStorage { get; set; }
+
+        /// <summary>
+        /// Specifies if the output geometry of PointAddress matches should be the rooftop point or street entrance location. Valid values are rooftop and street. The default value is street.
+        /// </summary>
+        [DataMember(Name = "locationType")]
+        public string LocationType { get; set; }
     }
+

     /// <summary>
     /// Reverse geocoding is useful for applications in which a user will click a location in a map and expect the address of that location to be returned.


Fixed structs not displaying interface implementations

--- src/ApiContractGenerator/CSharpTextFormatter.cs
+++ src/ApiContractGenerator/CSharpTextFormatter.cs
@@ -1070,23 +1070,18 @@
             writer.WriteLine('}');
         }

-        private void WriteBaseTypeAndInterfaces(IMetadataType metadataType, string currentNamespace)
+        private void WriteBaseTypeAndInterfaces(MetadataTypeReference baseType, IReadOnlyList<MetadataTypeReference> interfaceImplementations, string currentNamespace)
         {
             var didWriteColon = false;

-            if (metadataType.BaseType != null
-                && !(
-                    metadataType is IMetadataClass
-                    && metadataType.BaseType is TopLevelTypeReference topLevel
-                    && topLevel.Namespace == "System"
-                    && topLevel.Name == "Object"))
+            if (baseType != null)
             {
                 writer.Write(" : ");
                 didWriteColon = true;
-                Write(metadataType.BaseType, currentNamespace);
-            }
-
-            foreach (var interfaceImplementation in metadataType.InterfaceImplementations)
+                Write(baseType, currentNamespace);
+            }
+
+            foreach (var interfaceImplementation in interfaceImplementations)
             {
                 if (!didWriteColon)
                 {
@@ -1150,7 +1145,15 @@

             writer.Write("class ");
             WriteTypeNameAndGenericSignature(metadataClass, currentNamespace, declaringTypeNumGenericParameters);
-            WriteBaseTypeAndInterfaces(metadataClass, currentNamespace);
+
+            var isSystemObject = metadataClass.BaseType is TopLevelTypeReference topLevel
+                && topLevel.Namespace == "System"
+                && topLevel.Name == "Object";
+            WriteBaseTypeAndInterfaces(
+                isSystemObject ? null : metadataClass.BaseType,
+                metadataClass.InterfaceImplementations,
+                currentNamespace);
+
             WriteGenericConstraints(metadataClass.GenericTypeParameters, currentNamespace);
             writer.WriteLine();
             WriteTypeMembers(metadataClass, defaultMemberAttribute.Result, currentNamespace);
@@ -1180,6 +1183,7 @@

             writer.Write("struct ");
             WriteTypeNameAndGenericSignature(metadataStruct, currentNamespace, declaringTypeNumGenericParameters);
+            WriteBaseTypeAndInterfaces(null, metadataStruct.InterfaceImplementations, currentNamespace);
             writer.WriteLine();
             WriteTypeMembers(metadataStruct, defaultMemberAttribute.Result, currentNamespace);
         }
@@ -1194,7 +1198,7 @@
             WriteVisibility(metadataInterface.Visibility);
             writer.Write("interface ");
             WriteTypeNameAndGenericSignature(metadataInterface, currentNamespace, declaringTypeNumGenericParameters);
-            WriteBaseTypeAndInterfaces(metadataInterface, currentNamespace);
+            WriteBaseTypeAndInterfaces(metadataInterface.BaseType, metadataInterface.InterfaceImplementations, currentNamespace);
             writer.WriteLine();
             WriteTypeMembers(metadataInterface, defaultMemberAttribute.Result, currentNamespace);
         }


Make sure a version exists in a reference before acting like it is.

--- src/BibleBot.Backend/Services/ParsingService.cs
+++ src/BibleBot.Backend/Services/ParsingService.cs
@@ -176,9 +176,12 @@

                         var idealVersion = _versionService.Get(lastToken);

-                        if (idealVersion.Abbreviation == lastToken)
-                        {
-                            version = idealVersion;
+                        if (idealVersion != null)
+                        {
+                            if (idealVersion.Abbreviation == lastToken)
+                            {
+                                version = idealVersion;
+                            }
                         }
                     }
                 }


Buffer request message content for multiple reads

--- src/BizwebSharp/Infrastructure/RequestEngine.cs
+++ src/BizwebSharp/Infrastructure/RequestEngine.cs
@@ -269,6 +269,12 @@
         public static async Task<string> ExecuteRequestToStringAsync(BizwebRequestMessage requestMsg,
             IRequestExecutionPolicy execPolicy)
         {
+            if (requestMsg.Content != null)
+            {
+                //necessary to buffer content for multiple reads
+                await requestMsg.Content.LoadIntoBufferAsync();
+            }
+
             return await execPolicy.Run(requestMsg, async (reqMsg) =>
             {
                 //Need to create a RequestInfo before send RequestMessage
@@ -300,6 +306,12 @@
         public static async Task<JToken> ExecuteRequestAsync(BizwebRequestMessage requestMsg,
             IRequestExecutionPolicy execPolicy)
         {
+            if (requestMsg.Content != null)
+            {
+                //necessary to buffer content for multiple reads
+                await requestMsg.Content.LoadIntoBufferAsync();
+            }
+
             return await execPolicy.Run(requestMsg, async (reqMsg) =>
             {
                 //Need to create a RequestInfo before send RequestMessage


Add Login and Registration to nav menu

Add Login and Registration to nav menu

--- src/Claimini.BlazorClient/Shared/NavMenu.cshtml
+++ src/Claimini.BlazorClient/Shared/NavMenu.cshtml
@@ -10,6 +10,16 @@

             <NavLink class="nav-link" href="/" Match=NavLinkMatch.All>
                  Home
+            </NavLink>
+

+

+            <NavLink class="nav-link" href="/users/registration">
+                 Register
+            </NavLink>
+

+

+            <NavLink class="nav-link" href="/users/login">
+                 Login
             </NavLink>


Fix 2fa dictionary on identity response (#863)

--- src/Core/IdentityServer/BaseRequestValidator.cs
+++ src/Core/IdentityServer/BaseRequestValidator.cs
@@ -158,7 +158,7 @@
         protected async Task BuildTwoFactorResultAsync(User user, Organization organization, T context)
         {
             var providerKeys = new List<byte>();
-            var providers = new Dictionary<byte, Dictionary<string, object>>();
+            var providers = new Dictionary<string, Dictionary<string, object>>();

             var enabledProviders = new List<KeyValuePair<TwoFactorProviderType, TwoFactorProvider>>();
             if (organization?.GetTwoFactorProviders() != null)
@@ -188,7 +188,7 @@
             {
                 providerKeys.Add((byte)provider.Key);
                 var infoDict = await BuildTwoFactorParams(organization, user, provider.Key, provider.Value);
-                providers.Add((byte)provider.Key, infoDict);
+                providers.Add(((byte)provider.Key).ToString(), infoDict);
             }

             SetTwoFactorResult(context,


adjusted namespace

adjusted namespace

--- src/DocumentDbTests/Bugs/query_with_order_by.cs
+++ src/DocumentDbTests/Bugs/query_with_order_by.cs
@@ -1,16 +1,13 @@
 using System;
 using System.Linq;
-
+using Marten;
 using Marten.Testing.Documents;
 using Marten.Testing.Harness;
-
 using Shouldly;
-
 using Xunit;

-namespace Marten.Testing.Linq
+namespace DocumentDbTests.Bugs
 {
-    [ControlledQueryStoryteller]
     public class query_with_order_by: IntegrationContext
     {
         public query_with_order_by(DefaultStoreFixture fixture): base(fixture)


[BugBash] #54 - Fixed the validation errors not showing up

--- src/FunnelWeb.Web/Controllers/WikiController.cs
+++ src/FunnelWeb.Web/Controllers/WikiController.cs
@@ -96,7 +96,8 @@
                 model.Entry = entry;
                 model.IsPriorVersion = false;
                 model.Page = page;
-                return View("Page", model)
+                var masterPage = "PageTemplates/" + (entry.PageTemplate ?? "Default");
+                return View("Page", masterPage, model)
                     .AndFlash("Your comment was not posted - please check the validation errors below.");
             }


Delete PriceCurveFunctions.cs

Delete PriceCurveFunctions.cs

--- src/clients/Qwack.Excel/Curves/PriceCurveFunctions.cs
+++ src/clients/Qwack.Excel/Curves/PriceCurveFunctions.cs
@@ -1,471 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Threading.Tasks;
-using ExcelDna.Integration;
-using Qwack.Core.Curves;
-using Qwack.Excel.Services;
-using Qwack.Excel.Utils;
-using Microsoft.Extensions.Logging;
-using Microsoft.Extensions.DependencyInjection;
-using Qwack.Core.Instruments.Asset;
-using Qwack.Core.Models;
-using Qwack.Models;
-using Qwack.Core.Basic;
-using Qwack.Models.Models;
-using Qwack.Futures;
-using Qwack.Dates;
-using Qwack.Math;
-
-namespace Qwack.Excel.Curves
-{
-    public class PriceCurveFunctions
-    {
-        private static readonly ILogger _logger = ContainerStores.GlobalContainer.GetService<ILoggerFactory>()?.CreateLogger<PriceCurveFunctions>();
-
-        [ExcelFunction(Description = "Creates a price curve", Category = CategoryNames.Curves, Name = CategoryNames.Curves + "_" + nameof(CreatePriceCurve))]
-        public static object CreatePriceCurve(
-             [ExcelArgument(Description = "Object name")] string ObjectName,
-             [ExcelArgument(Description = "Asset Id")] string AssetId,
-             [ExcelArgument(Description = "Build date")] DateTime BuildDate,
-             [ExcelArgument(Description = "Array of pillar dates")] double[] Pillars,
-             [ExcelArgument(Description = "Array of prices values")] double[] Prices,
-             [ExcelArgument(Description = "Type of curve, e.g. LME, ICE, NYMEX etc")] object CurveType,
-             [ExcelArgument(Description = "Array of pillar labels (optional)")] object PillarLabels,
-             [ExcelArgument(Description = "Currency - default USD")] object Currency,
-             [ExcelArgument(Description = "Collateral spec, required for delta calculation - default LIBOR.3M")] object CollateralSpec,
-             [ExcelArgument(Description = "Spot lag, required for theta, default 0b")] object SpotLag,
-             [ExcelArgument(Description = "Spot calendar, required for theta, default USD")] object SpotCalendar)
-        {
-            return ExcelHelper.Execute(_logger, () =>
-            {
-                var curveTypeStr = CurveType.OptionalExcel("Linear");
-                var ccy = Currency.OptionalExcel("USD");
-                var colSpec = CollateralSpec.OptionalExcel("LIBOR.3M");
-                var spotLagStr = SpotLag.OptionalExcel("0b");
-                var spotCalStr = SpotCalendar.OptionalExcel("USD");
-
-                if (!Enum.TryParse(curveTypeStr, out PriceCurveType cType))
-                {
-                    return $"Could not parse price curve type - {curveTypeStr}";
-                }
-
-                ContainerStores.SessionContainer.GetService<ICalendarProvider>().Collection.TryGetCalendar(ccy, out var ccyCal);
-                ContainerStores.SessionContainer.GetService<ICalendarProvider>().Collection.TryGetCalendar(spotCalStr, out var spotCal);
-                var ccyObj = ContainerStores.GlobalContainer.GetRequiredService<ICurrencyProvider>()[ccy];
-
-                var labels = (PillarLabels is ExcelMissing) ? null : ((object[,])PillarLabels).ObjectRangeToVector<string>();
-
-                var pDates = Pillars.ToDateTimeArray();
-                var cObj = new PriceCurve(BuildDate, pDates, Prices, cType, ContainerStores.GlobalContainer.GetRequiredService<ICurrencyProvider>(), labels)
-                {
-                    Name = AssetId ?? ObjectName,
-                    AssetId = AssetId ?? ObjectName,
-                    Currency = ccyObj,
-                    CollateralSpec = colSpec,
-                    SpotCalendar = spotCal,
-                    SpotLag = new Frequency(spotLagStr)
-                };
-
-                var cache = ContainerStores.GetObjectCache<IPriceCurve>();
-                cache.PutObject(ObjectName, new SessionItem<IPriceCurve> { Name = ObjectName, Value = cObj });
-                return ObjectName + '¬' + cache.GetObject(ObjectName).Version;
-            });
-        }
-
-        [ExcelFunction(Description = "Creates a contango price curve for precious metals", Category = CategoryNames.Curves, Name = CategoryNames.Curves + "_" + nameof(CreateContangoPriceCurve))]
-        public static object CreateContangoPriceCurve(
-            [ExcelArgument(Description = "Object name")] string ObjectName,
-            [ExcelArgument(Description = "Asset Id")] string AssetId,
-            [ExcelArgument(Description = "Build date")] DateTime BuildDate,
-            [ExcelArgument(Description = "Spot date")] DateTime SpotDate,
-            [ExcelArgument(Description = "Spot price")] double SpotPrice,
-            [ExcelArgument(Description = "Array of pillar dates")] double[] Pillars,
-            [ExcelArgument(Description = "Array of contango values")] double[] ContangoRates,
-            [ExcelArgument(Description = "Array of pillar labels (optional)")] object PillarLabels)
-        {
-            return ExcelHelper.Execute(_logger, () =>
-            {
-                var labels = (PillarLabels is ExcelMissing) ? null : ((object[,])PillarLabels).ObjectRangeToVector<string>();
-                var pDates = Pillars.ToDateTimeArray();
-                var cObj = new ContangoPriceCurve(BuildDate, SpotPrice, SpotDate, pDates, ContangoRates, ContainerStores.GlobalContainer.GetRequiredService<ICurrencyProvider>(), Qwack.Dates.DayCountBasis.Act360, labels)
-                {
-                    Name = AssetId ?? ObjectName,
-                    AssetId = AssetId ?? ObjectName
-                };
-                var cache = ContainerStores.GetObjectCache<IPriceCurve>();
-                cache.PutObject(ObjectName, new SessionItem<IPriceCurve> { Name = ObjectName, Value = cObj });
-                return ObjectName + '¬' + cache.GetObject(ObjectName).Version;
-            });
-        }
-
-        [ExcelFunction(Description = "Creates a sparse price curve", Category = CategoryNames.Curves, Name = CategoryNames.Curves + "_" + nameof(CreateSparsePriceCurve))]
-        public static object CreateSparsePriceCurve(
-            [ExcelArgument(Description = "Object name")] string ObjectName,
-            [ExcelArgument(Description = "Asset Id")] string AssetId,
-            [ExcelArgument(Description = "Build date")] DateTime BuildDate,
-            [ExcelArgument(Description = "Array of pillar dates")] double[] Pillars,
-            [ExcelArgument(Description = "Array of prices values")] double[] Prices,
-            [ExcelArgument(Description = "Type of curve, e.g. Coal etc")] object CurveType)
-        {
-            return ExcelHelper.Execute(_logger, () =>
-            {
-                var curveTypeStr = CurveType.OptionalExcel<string>("Coal");
-                if (!Enum.TryParse(curveTypeStr, out SparsePriceCurveType cType))
-                {
-                    return $"Could not parse price curve type - {curveTypeStr}";
-                }
-
-                var pDates = Pillars.ToDateTimeArray();
-                var cObj = new SparsePriceCurve(BuildDate, pDates, Prices, cType, ContainerStores.GlobalContainer.GetRequiredService<ICurrencyProvider>())
-                {
-                    Name = AssetId ?? ObjectName,
-                    AssetId = AssetId ?? ObjectName
-                };
-                var cache = ContainerStores.GetObjectCache<IPriceCurve>();
-                cache.PutObject(ObjectName, new SessionItem<IPriceCurve> { Name = ObjectName, Value = cObj });
-                return ObjectName + '¬' + cache.GetObject(ObjectName).Version;
-            });
-        }
-
-        [ExcelFunction(Description = "Creates a sparse price curve from swap objects", Category = CategoryNames.Curves, Name = CategoryNames.Curves + "_" + nameof(CreateSparsePriceCurveFromSwaps))]
-        public static object CreateSparsePriceCurveFromSwaps(
-            [ExcelArgument(Description = "Object name")] string ObjectName,
-            [ExcelArgument(Description = "Asset Id")] string AssetId,
-            [ExcelArgument(Description = "Build date")] DateTime BuildDate,
-            [ExcelArgument(Description = "Array of pillar dates")] double[] Pillars,
-            [ExcelArgument(Description = "Array of swap objects")] object[] Swaps,
-            [ExcelArgument(Description = "Discount curve name")] string DiscountCurveName,
-            [ExcelArgument(Description = "Type of curve, e.g. Coal etc")] object CurveType)
-        {
-            return ExcelHelper.Execute(_logger, () =>
-            {
-                var curveTypeStr = CurveType.OptionalExcel<string>("Coal");
-                if (!Enum.TryParse(curveTypeStr, out SparsePriceCurveType cType))
-                {
-                    return $"Could not parse price curve type - {curveTypeStr}";
-                }
-
-                var irCache = ContainerStores.GetObjectCache<IIrCurve>();
-                if (!irCache.TryGetObject(DiscountCurveName, out var irCurveObj))
-                {
-                    return $"Could not find ir curve with name {DiscountCurveName}";
-                }
-                var irCurve = irCurveObj.Value;
-
-                var swapCache = ContainerStores.GetObjectCache<AsianSwapStrip>();
-                var swaps = Swaps.Select(s => swapCache.GetObject(s as string)).Select(x => x.Value);
-
-                var pDates = Pillars.ToDateTimeArray();
-                var fitter = new Core.Calibrators.NewtonRaphsonAssetCurveSolver();
-                var cObj = (SparsePriceCurve)fitter.Solve(swaps.ToList(), pDates.ToList(), irCurve, BuildDate, ContainerStores.GlobalContainer.GetRequiredService<ICurrencyProvider>());
-                cObj.Name = AssetId ?? ObjectName;
-                cObj.AssetId = AssetId ?? ObjectName;
-
-                var cache = ContainerStores.GetObjectCache<IPriceCurve>();
-                cache.PutObject(ObjectName, new SessionItem<IPriceCurve> { Name = ObjectName, Value = cObj });
-                return ObjectName + '¬' + cache.GetObject(ObjectName).Version;
-            });
-        }
-
-        [ExcelFunction(Description = "Creates a price curve from basis swap objects", Category = CategoryNames.Curves, Name = CategoryNames.Curves + "_" + nameof(CreatePriceCurveFromBasisSwaps))]
-        public static object CreatePriceCurveFromBasisSwaps(
-          [ExcelArgument(Description = "Object name")] string ObjectName,
-          [ExcelArgument(Description = "Asset Id")] string AssetId,
-          [ExcelArgument(Description = "Base curve object")] string BaseCurve,
-          [ExcelArgument(Description = "Build date")] DateTime BuildDate,
-          [ExcelArgument(Description = "Array of pillar dates")] double[] Pillars,
-          [ExcelArgument(Description = "Array of swap objects")] object[] Swaps,
-          [ExcelArgument(Description = "Discount curve name")] string DiscountCurveName,
-          [ExcelArgument(Description = "Type of curve, e.g. LME, ICE, NYMEX etc")] object CurveType)
-        {
-            return ExcelHelper.Execute(_logger, () =>
-            {
-                var curveTypeStr = CurveType.OptionalExcel<string>("Coal");
-                if (!Enum.TryParse(curveTypeStr, out PriceCurveType cType))
-                {
-                    return $"Could not parse price curve type - {curveTypeStr}";
-                }
-
-                var irCache = ContainerStores.GetObjectCache<IIrCurve>();
-                if(!irCache.TryGetObject(DiscountCurveName, out var irCurveObj))
-                {
-                    return $"Could not find ir curve with name {DiscountCurveName}";
-                }
-                var irCurve = irCurveObj.Value;
-
-                var curveCache = ContainerStores.GetObjectCache<IPriceCurve>();
-                if (!curveCache.TryGetObject(BaseCurve, out var bCurveObj))
-                {
-                    return $"Could not find ir curve with name {DiscountCurveName}";
-                }
-                var baseCurve = bCurveObj.Value;
-
-                var swapCache = ContainerStores.GetObjectCache<AsianBasisSwap>();
-                var swaps = Swaps.Select(s => swapCache.GetObject(s as string)).Select(x => x.Value);
-
-                var pDates = Pillars.ToDateTimeArray();
-                var fitter = new Core.Calibrators.NewtonRaphsonAssetBasisCurveSolver(ContainerStores.CurrencyProvider);
-                var cObj = (PriceCurve)fitter.SolveCurve(swaps.ToList(), pDates.ToList(), irCurve, baseCurve, BuildDate, cType);
-                cObj.Name = AssetId ?? ObjectName;
-                cObj.AssetId = AssetId ?? ObjectName;
-
-                curveCache.PutObject(ObjectName, new SessionItem<IPriceCurve> { Name = ObjectName, Value = cObj });
-                return ObjectName + '¬' + curveCache.GetObject(ObjectName).Version;
-            });
-        }
-
-        [ExcelFunction(Description = "Queries a price curve for a price for a give date", Category = CategoryNames.Curves, Name = CategoryNames.Curves + "_" + nameof(GetPrice))]
-        public static object GetPrice(
-            [ExcelArgument(Description = "Object name")] string ObjectName,
-            [ExcelArgument(Description = "Price date")] DateTime Date)
-        {
-            return ExcelHelper.Execute(_logger, () =>
-            {
-                if (ContainerStores.GetObjectCache<IPriceCurve>().TryGetObject(ObjectName, out var curve))
-                {
-                    return curve.Value.GetPriceForDate(Date);
-                }
-
-                return $"Price curve {ObjectName} not found in cache";
-            });
-        }
-
-        [ExcelFunction(Description = "Queries a price curve for an average price for give dates", Category = CategoryNames.Curves, Name = CategoryNames.Curves + "_" + nameof(GetAveragePrice))]
-        public static object GetAveragePrice(
-            [ExcelArgument(Description = "Object name")] string ObjectName,
-            [ExcelArgument(Description = "Price dates")] double[] Dates)
-        {
-            return ExcelHelper.Execute(_logger, () =>
-            {
-                if (ContainerStores.GetObjectCache<IPriceCurve>().TryGetObject(ObjectName, out var curve))
-                {
-                    return curve.Value.GetAveragePriceForDates(Dates.ToDateTimeArray());
-                }
-
-                return $"Price curve {ObjectName} not found in cache";
-            });
-        }
-
-        [ExcelFunction(Description = "Creates a new Asset-FX model", Category = CategoryNames.Curves, Name = CategoryNames.Curves + "_" + nameof(CreateAssetFxModel))]
-        public static object CreateAssetFxModel(
-            [ExcelArgument(Description = "Object name")] string ObjectName,
-            [ExcelArgument(Description = "Build date")] DateTime BuildDate,
-            [ExcelArgument(Description = "Price curves")] object[] PriceCurves,
-            [ExcelArgument(Description = "Vol surfaces")] object[] VolSurfaces,
-            [ExcelArgument(Description = "Funding model")] object[] FundingModel,
-            [ExcelArgument(Description = "Fixing dictionaries")] object[] Fixings,
-            [ExcelArgument(Description = "Correlation matrix")] object[] CorrelationMatrix)
-        {
-            return ExcelHelper.Execute(_logger, () =>
-            {
-                var curves = PriceCurves.GetAnyFromCache<IPriceCurve>();
-                var fundingModel = FundingModel.GetAnyFromCache<IFundingModel>().First();
-                var fixings = Fixings.GetAnyFromCache<IFixingDictionary>();
-                var volSurfaces = VolSurfaces.GetAnyFromCache<IVolSurface>();
-                var correlatinMatrix = CorrelationMatrix.GetAnyFromCache<ICorrelationMatrix>();
-
-                var model = new AssetFxModel(BuildDate, fundingModel);
-
-                foreach (var curve in curves)
-                    model.AddPriceCurve(curve.Name, curve);
-                foreach (var vs in volSurfaces)
-                    model.AddVolSurface(vs.Name, vs);
-                foreach (var f in fixings)
-                    model.AddFixingDictionary(f.Name, f);
-
-                if(correlatinMatrix.Any())
-                {
-                    model.CorrelationMatrix = correlatinMatrix.First();
-                }
-
-                var cache = ContainerStores.GetObjectCache<IAssetFxModel>();
-                cache.PutObject(ObjectName, new SessionItem<IAssetFxModel> { Name = ObjectName, Value = model });
-                return ObjectName + '¬' + cache.GetObject(ObjectName).Version;
-            });
-        }
-
-        [ExcelFunction(Description = "Creates a fixing dictionary", Category = CategoryNames.Curves, Name = CategoryNames.Curves + "_" + nameof(CreateFixingDictionary))]
-        public static object CreateFixingDictionary(
-            [ExcelArgument(Description = "Object name")] string ObjectName,
-            [ExcelArgument(Description = "Asset Id")] string AssetId,
-            [ExcelArgument(Description = "Fixings array, 1st column dates / 2nd column fixings")] object[,] Fixings,
-            [ExcelArgument(Description = "Type, Asset or FX - default Asset")] object FixingType,
-            [ExcelArgument(Description = "Fx pair (optional)")] string FxPair)
-        {
-            return ExcelHelper.Execute(_logger, () =>
-            {
-                var fixTypeStr = FixingType.OptionalExcel("Asset");
-                if(!Enum.TryParse<FixingDictionaryType>(fixTypeStr, out var fixType))
-                {
-                    throw new Exception($"Unknown fixing dictionary type {fixTypeStr}");
-                }
-                var dict = new FixingDictionary
-                {
-                    Name = AssetId,
-                    AssetId = AssetId,
-                    FixingDictionaryType = fixType,
-                    FxPair = FxPair
-                };
-
-                var dictData = Fixings.RangeToDictionary<DateTime, double>();
-                foreach (var kv in dictData)
-                    dict.Add(kv.Key, kv.Value);
-
-                var cache = ContainerStores.GetObjectCache<IFixingDictionary>();
-                cache.PutObject(ObjectName, new SessionItem<IFixingDictionary> { Name = ObjectName, Value = dict });
-                return ObjectName + '¬' + cache.GetObject(ObjectName).Version;
-            });
-        }
-
-        [ExcelFunction(Description = "Creates a fixing dictionary", Category = CategoryNames.Curves, Name = CategoryNames.Curves + "_" + nameof(CreateFixingDictionaryFromVectors))]
-        public static object CreateFixingDictionaryFromVectors(
-            [ExcelArgument(Description = "Object name")] string ObjectName,
-            [ExcelArgument(Description = "Asset Id")] string AssetId,
-            [ExcelArgument(Description = "Fixings dates")] double[] FixingDates,
-            [ExcelArgument(Description = "Fixings dates")] double[] Fixings,
-            [ExcelArgument(Description = "Type, Asset or FX - default Asset")] object FixingType,
-            [ExcelArgument(Description = "Fx pair (optional)")] string FxPair)
-        {
-            return ExcelHelper.Execute(_logger, () =>
-            {
-                if (FixingDates.Length != Fixings.Length)
-                    throw new Exception("Fixings and FixingDates must be of same length");
-
-                var fixTypeStr = FixingType.OptionalExcel("Asset");
-                if (!Enum.TryParse<FixingDictionaryType>(fixTypeStr, out var fixType))
-                {
-                    throw new Exception($"Unknown fixing dictionary type {fixTypeStr}");
-                }
-
-                var dict = new FixingDictionary
-                {
-                    Name = AssetId,
-                    AssetId = AssetId,
-                    FixingDictionaryType = fixType,
-                    FxPair = FxPair
-                };
-                for (var i = 0; i < FixingDates.Length; i++)
-                    if (FixingDates[i] != 0)
-                        dict.Add(DateTime.FromOADate(FixingDates[i]), Fixings[i]);
-
-                var cache = ContainerStores.GetObjectCache<IFixingDictionary>();
-                cache.PutObject(ObjectName, new SessionItem<IFixingDictionary> { Name = ObjectName, Value = dict });
-                return ObjectName + '¬' + cache.GetObject(ObjectName).Version;
-            });
-        }
-
-        [ExcelFunction(Description = "Creates a fixing dictionary for a rolling futures index", Category = CategoryNames.Curves, Name = CategoryNames.Curves + "_" + nameof(CreateFixingDictionaryForRollingFuture))]
-        public static object CreateFixingDictionaryForRollingFuture(
-            [ExcelArgument(Description = "Object name")] string ObjectName,
-            [ExcelArgument(Description = "Asset Id")] string AssetId,
-            [ExcelArgument(Description = "Futures code, e.g. QS or CO")] string FuturesCode,
-            [ExcelArgument(Description = "1st month fixings array, 1st column dates / 2nd column fixings")] object[,] Fixings1m,
-            [ExcelArgument(Description = "2nd month fixings array, 1st column dates / 2nd column fixings")] object[,] Fixings2m)
-        {
-            return ExcelHelper.Execute(_logger, () =>
-            {
-                var dict = new FixingDictionary
-                {
-                    Name = AssetId,
-                    AssetId = AssetId,
-                    FixingDictionaryType = FixingDictionaryType.Asset
-                };
-                var futuresProvider = ContainerStores.SessionContainer.GetRequiredService<IFutureSettingsProvider>();
-                var dictData1m = Fixings1m.RangeToDictionary<DateTime, double>();
-                var dictData2m = Fixings2m.RangeToDictionary<DateTime, double>();
-                var fc = new FutureCode(FuturesCode, futuresProvider);
-                fc.YearBeforeWhich2DigitDatesAreUsed = DateTime.Today.Year - 2;
-
-                foreach (var kv in dictData1m)
-                {
-                    var currentFM = fc.GetFrontMonth(kv.Key, true);
-                    var cfm = new FutureCode(currentFM, DateTime.Today.Year - 2, futuresProvider);
-                    if(kv.Key<=cfm.GetRollDate())
-                        dict.Add(kv.Key, kv.Value);
-                    else
-                        dict.Add(kv.Key, dictData2m[kv.Key]);
-                }
-
-                var cache = ContainerStores.GetObjectCache<IFixingDictionary>();
-                cache.PutObject(ObjectName, new SessionItem<IFixingDictionary> { Name = ObjectName, Value = dict });
-                return ObjectName + '¬' + cache.GetObject(ObjectName).Version;
-            });
-        }
-
-        [ExcelFunction(Description = "Display contents of a fixing dictionary", Category = CategoryNames.Curves, Name = CategoryNames.Curves + "_" + nameof(DisplayFixingDictionary))]
-        public static object DisplayFixingDictionary(
-            [ExcelArgument(Description = "Object name")] string ObjectName,
-            [ExcelArgument(Description = "Optional - fixing date")] object FixingDate,
-            [ExcelArgument(Description = "Reverse sort order, False (default) or True")] bool ReverseSort)
-        {
-            return ExcelHelper.Execute(_logger, () =>
-            {
-                var dict = ContainerStores.GetObjectCache<IFixingDictionary>().GetObjectOrThrow(ObjectName, $"Fixing dictionary not found with name {ObjectName}");
-
-                if (FixingDate is ExcelMissing)
-                {
-                    var o = new object[dict.Value.Count, 2];
-                    var c = 0;
-
-                    if (ReverseSort)
-                        foreach (var kv in dict.Value.OrderByDescending(x=>x.Key))
-                        {
-                            o[c, 0] = kv.Key;
-                            o[c, 1] = kv.Value;
-                            c++;
-                        }
-                    else
-                        foreach (var kv in dict.Value)
-                        {
-                            o[c, 0] = kv.Key;
-                            o[c, 1] = kv.Value;
-                            c++;
-                        }
-
-                    return o;
-                }
-                else
-                {
-                    var d = FixingDate as double?;
-                    if (!d.HasValue || !dict.Value.TryGetValue(DateTime.FromOADate(d.Value), out var fixing))
-                        throw new Exception($"Fixing not found for date {FixingDate}");
-
-                    return fixing;
-                }
-            });
-        }
-
-        [ExcelFunction(Description = "Creates a correlation matrix", Category = CategoryNames.Curves, Name = CategoryNames.Curves + "_" + nameof(CreateCorrelationMatrix))]
-        public static object CreateCorrelationMatrix(
-            [ExcelArgument(Description = "Object name")] string ObjectName,
-            [ExcelArgument(Description = "Labels X")] object[] LabelsX,
-            [ExcelArgument(Description = "Labels Y")] object[] LabelsY,
-            [ExcelArgument(Description = "Correlations")] double[,] Correlations)
-        {
-            return ExcelHelper.Execute(_logger, () =>
-            {
-                var matrix = new CorrelationMatrix(LabelsX.ObjectRangeToVector<string>(), LabelsY.ObjectRangeToVector<string>(), Correlations);
-
-                var cache = ContainerStores.GetObjectCache<ICorrelationMatrix>();
-                cache.PutObject(ObjectName, new SessionItem<ICorrelationMatrix> { Name = ObjectName, Value = matrix });
-                return ObjectName + '¬' + cache.GetObject(ObjectName).Version;
-            });
-        }
-
-        [ExcelFunction(Description = "Bends a spread curve to a sparse set of updated spreads", Category = CategoryNames.Curves, Name = CategoryNames.Curves + "_" + nameof(BendCurve))]
-        public static object BendCurve(
-            [ExcelArgument(Description = "Input spreads")] double[] InputSpreads,
-            [ExcelArgument(Description = "Sparse new spreads")] object[] SparseNewSpreads)
-        {
-            return ExcelHelper.Execute(_logger, () =>
-            {
-                var sparseSpreads = SparseNewSpreads
-                    .Select(x => x is ExcelEmpty || !(x is double) ?
-                    null : (double?)x).ToArray();
-                var o = CurveBender.Bend(InputSpreads, sparseSpreads);
-                return o.ReturnExcelRangeVectorFromDouble();
-            });
-        }
-    }
-}


Android - C# 6 refactor and fix some memory leaks

--- src/Media.Plugin.Android/MediaImplementation.cs
+++ src/Media.Plugin.Android/MediaImplementation.cs
@@ -49,37 +49,20 @@
         }

         ///<inheritdoc/>
-        public Task<bool> Initialize()
-        {
-            return Task.FromResult(true);
-        }
+        public Task<bool> Initialize() => Task.FromResult(true);

         /// <inheritdoc/>
-        public bool IsCameraAvailable
-        {
-            get;
-            private set;
-        }
+        public bool IsCameraAvailable { get; }
         /// <inheritdoc/>
-        public bool IsTakePhotoSupported
-        {
-            get { return true; }
-        }
+        public bool IsTakePhotoSupported => true;
+
         /// <inheritdoc/>
-        public bool IsPickPhotoSupported
-        {
-            get { return true; }
-        }
+        public bool IsPickPhotoSupported => true;
+
         /// <inheritdoc/>
-        public bool IsTakeVideoSupported
-        {
-            get { return true; }
-        }
+        public bool IsTakeVideoSupported => true;
         /// <inheritdoc/>
-        public bool IsPickVideoSupported
-        {
-            get { return true; }
-        }
+        public bool IsPickVideoSupported => true;

         /// <summary>
         ///
@@ -135,7 +118,7 @@
         /// <returns>Media file or null if canceled</returns>
         public async Task<MediaFile> PickPhotoAsync()
         {
-            if (!(await RequestStoragePermission().ConfigureAwait(false)))
+            if (!(await RequestStoragePermission()))
             {
                 return null;
             }
@@ -173,7 +156,7 @@
             if (!IsCameraAvailable)
                 throw new NotSupportedException();

-            if (!(await RequestStoragePermission().ConfigureAwait(false)))
+            if (!(await RequestStoragePermission()))
             {
                 return null;
             }
@@ -207,7 +190,7 @@
                     }
                     catch(Exception ex)
                     {
-                        Console.WriteLine("Unable to shrink image: {ex}");
+                        Console.WriteLine($"Unable to shrink image: {ex}");
                     }
                 }
             }
@@ -242,7 +225,7 @@
         public async Task<MediaFile> PickVideoAsync()
         {

-            if (!(await RequestStoragePermission().ConfigureAwait(false)))
+            if (!(await RequestStoragePermission()))
             {
                 return null;
             }
@@ -260,7 +243,7 @@
             if (!IsCameraAvailable)
                 throw new NotSupportedException();

-            if (!(await RequestStoragePermission().ConfigureAwait(false)))
+            if (!(await RequestStoragePermission()))
             {
                 return null;
             }
@@ -334,11 +317,11 @@
             return id;
         }

-        private Task<Plugin.Media.Abstractions.MediaFile> TakeMediaAsync(string type, string action, StoreMediaOptions options)
+        private Task<MediaFile> TakeMediaAsync(string type, string action, StoreMediaOptions options)
         {
             int id = GetRequestId();

-            var ntcs = new TaskCompletionSource<Plugin.Media.Abstractions.MediaFile>(id);
+            var ntcs = new TaskCompletionSource<MediaFile>(id);
             if (Interlocked.CompareExchange(ref this.completionSource, ntcs, null) != null)
                 throw new InvalidOperationException("Only one operation can be active at a time");

@@ -383,14 +366,16 @@
                 if (!orientation.HasValue)
                     return false;

-                var bmp = RotateImage(filePath, orientation.Value);
-
-                using (var stream = File.Open(filePath, FileMode.OpenOrCreate))
-                    await bmp.CompressAsync(Bitmap.CompressFormat.Png, 92, stream);
-
-                bmp.Recycle();
-
-                return true;
+                using (var bmp = RotateImage(filePath, orientation.Value))
+                {
+
+                    using (var stream = File.Open(filePath, FileMode.OpenOrCreate))
+                        await bmp.CompressAsync(Bitmap.CompressFormat.Png, 92, stream);
+
+                    bmp.Recycle();
+
+                    return true;
+                }
             }
             catch (Exception ex)
             {
@@ -406,40 +391,44 @@
         {
             try
             {
-                var ei = new ExifInterface(filePath);
-                var orientation = (Orientation)ei.GetAttributeInt(ExifInterface.TagOrientation, (int)Orientation.Normal);
-                switch (orientation)
-                {
-                    case Orientation.Rotate90:
-                        return 90;
-                    case Orientation.Rotate180:
-                        return 180;
-                    case Orientation.Rotate270:
-                        return 270;
-                    default:
-                        return null;
-                }
-
+                using (var ei = new ExifInterface(filePath))
+                {
+                    var orientation = (Orientation)ei.GetAttributeInt(ExifInterface.TagOrientation, (int)Orientation.Normal);
+
+                    switch (orientation)
+                    {
+                        case Orientation.Rotate90:
+                            return 90;
+                        case Orientation.Rotate180:
+                            return 180;
+                        case Orientation.Rotate270:
+                            return 270;
+                        default:
+                            return null;
+                    }
+                }
             }
             catch (Exception ex)
             {
 #if DEBUG
                 throw ex;
 #else
-            return null;
+                return null;
 #endif
             }
         }

         private static Bitmap RotateImage(string filePath, int rotation)
         {
-            var originalImage = BitmapFactory.DecodeFile(filePath);
-
-            var matrix = new Matrix();
-            matrix.PostRotate(rotation);
-            var rotatedImage = Bitmap.CreateBitmap(originalImage, 0, 0, originalImage.Width, originalImage.Height, matrix, true);
-            originalImage.Recycle();
-            return rotatedImage;
+            using (var originalImage = BitmapFactory.DecodeFile(filePath))
+            {
+
+                var matrix = new Matrix();
+                matrix.PostRotate(rotation);
+                var rotatedImage = Bitmap.CreateBitmap(originalImage, 0, 0, originalImage.Width, originalImage.Height, matrix, true);
+                originalImage.Recycle();
+                return rotatedImage;
+            }
         }
     }


Add null check #423

Add null check #423

--- src/Media.Plugin.Android/MediaImplementation.cs
+++ src/Media.Plugin.Android/MediaImplementation.cs
@@ -586,6 +586,9 @@

                         //this now will return the requested width/height from file, so no longer need to scale
                         var originalImage = BitmapFactory.DecodeFile(filePath, options);
+
+						if (originalImage == null)
+							return false;

                         if (finalWidth != originalImage.Width || finalHeight != originalImage.Height)
                         {


Clear session on logoff

Clear session on logoff

--- src/MusicStore/Controllers/AccountController.cs
+++ src/MusicStore/Controllers/AccountController.cs
@@ -97,9 +97,9 @@
                 return View(model);
             }

-            // The following code protects for brute force attacks against the two factor codes.
-            // If a user enters incorrect codes for a specified amount of time then the user account
-            // will be locked out for a specified amount of time.
+            // The following code protects for brute force attacks against the two factor codes.
+            // If a user enters incorrect codes for a specified amount of time then the user account
+            // will be locked out for a specified amount of time.
             // You can configure the account lockout settings in IdentityConfig
             var result = await SignInManager.TwoFactorSignInAsync(model.Provider, model.Code, model.RememberMe, model.RememberBrowser);
             if (result.Succeeded)
@@ -437,6 +437,9 @@
         [ValidateAntiForgeryToken]
         public async Task<ActionResult> LogOff()
         {
+            // clear all items from the cart
+            Context.Session.Clear();
+
             await SignInManager.SignOutAsync();

             // TODO: Currently SignInManager.SignOut does not sign out OpenIdc and does not have a way to pass in a specific


Fixed formatting and added the cases spec

--- src/NUnitConsole/nunit-console/OutputManager.cs
+++ src/NUnitConsole/nunit-console/OutputManager.cs
@@ -52,34 +52,32 @@
             Console.WriteLine("Results ({0}) saved as {1}", spec.Format, outputPath);
         }

-        private string GetOutputPath( string filename )
+        private string GetOutputPath(string filename)
         {
-            return Path.Combine( _workDirectory, filename );
+            return Path.Combine(_workDirectory, filename);
         }

-        private static IResultWriter CreateOutputWriter( string spec, string transform )
+        private static IResultWriter CreateOutputWriter(string spec, string transform)
         {
-            IResultWriter outputWriter;
-            switch ( spec )
+            switch (spec)
             {
                 case "nunit3":
-                    outputWriter = new NUnit3XmlOutputWriter( );
-                    break;
+                    return new NUnit3XmlOutputWriter();

                 case "nunit2":
-                    outputWriter = new NUnit2XmlOutputWriter( );
-                    break;
+                    return new NUnit2XmlOutputWriter();
+
+                case "cases":
+                    return new TestCaseOutputWriter();

                 case "user":
-                    Uri uri = new Uri( Assembly.GetExecutingAssembly( ).CodeBase );
-                    string dir = Path.GetDirectoryName( uri.LocalPath );
-                    outputWriter = new XmlTransformOutputWriter( Path.Combine( dir, transform ) );
-                    break;
+                    Uri uri = new Uri(Assembly.GetExecutingAssembly().CodeBase);
+                    string dir = Path.GetDirectoryName(uri.LocalPath);
+                    return new XmlTransformOutputWriter(Path.Combine(dir, transform));

                 default:
-                    throw new ArgumentException( string.Format( "Invalid XML output format '{0}'", spec ), "spec" );
+                    throw new ArgumentException(string.Format("Invalid XML output format '{0}'", spec), "spec");
             }
-            return outputWriter;
         }
     }
 }


add adaptive password hasher to sample

add adaptive password hasher to sample

--- samples/VS2013.Update1/VS2013.Update1/App_Start/IdentityConfig.cs
+++ samples/VS2013.Update1/VS2013.Update1/App_Start/IdentityConfig.cs
@@ -33,6 +33,7 @@
                 AllowOnlyAlphanumericUserNames = false,
                 RequireUniqueEmail = true
             };
+            manager.PasswordHasher = new AdaptivePasswordHasher(50000);
             // Configure validation logic for passwords
             //manager.PasswordValidator = new PasswordValidator
             //{


Fix #13671: [Flaky test] BearerTokenAuthenticationPolicy_SucceededFailedSucceeded (#13685)

* Assert call count before exception assert

* Try using `Interlocked` to increase `callCount`

* Adjust tokenRefreshOffset

--- sdk/core/Azure.Core/tests/BearerTokenAuthenticationPolicyTests.cs
+++ sdk/core/Azure.Core/tests/BearerTokenAuthenticationPolicyTests.cs
@@ -158,21 +158,19 @@
         public async Task BearerTokenAuthenticationPolicy_SucceededFailedSucceeded()
         {
             var requestMre = new ManualResetEventSlim(false);
-            var responseMre = new ManualResetEventSlim(false);
             var callCount = 0;
             var credential = new TokenCredentialStub((r, c) =>
             {
-                callCount++;
+                Interlocked.Increment(ref callCount);
                 var offsetTime = DateTimeOffset.UtcNow;
                 requestMre.Set();
-                responseMre.Wait(c);

                 return callCount == 2
                     ? throw new InvalidOperationException("Call Failed")
                     : new AccessToken(Guid.NewGuid().ToString(), offsetTime.AddMilliseconds(1000));
             }, IsAsync);

-            var policy = new BearerTokenAuthenticationPolicy(credential, "scope");
+            var policy = new BearerTokenAuthenticationPolicy(credential, new[] { "scope" }, TimeSpan.FromMilliseconds(100), TimeSpan.FromSeconds(30));
             MockTransport transport = CreateMockTransport(r => new MockResponse(200));

             var firstRequestTask = SendGetRequest(transport, policy, uri: new Uri("https://example.com/1"));
@@ -180,30 +178,25 @@

             requestMre.Wait();
             await Task.Delay(200);
-            responseMre.Set();
-
-            await Task.Delay(800);
+
             await Task.WhenAll(firstRequestTask, secondRequestTask);
+            await Task.Delay(1000);

             Assert.AreEqual(1, callCount);
-            responseMre.Reset();
             requestMre.Reset();

             var failedTask = SendGetRequest(transport, policy, uri: new Uri("https://example.com/3/failed"));
             requestMre.Wait();
-            responseMre.Set();
-
+
+            Assert.AreEqual(2, callCount);
             Assert.ThrowsAsync<InvalidOperationException>(async () => await failedTask);

-            Assert.AreEqual(2, callCount);
-            responseMre.Reset();
             requestMre.Reset();

             firstRequestTask = SendGetRequest(transport, policy, uri: new Uri("https://example.com/4"));
             secondRequestTask = SendGetRequest(transport, policy, uri: new Uri("https://example.com/5"));

             requestMre.Wait();
-            responseMre.Set();

             await Task.WhenAll(firstRequestTask, secondRequestTask);


CCCamera: Removing redundant static ZEye

* remnant from old way 3d support was incorporated

--- src/CCCamera.cs
+++ src/CCCamera.cs
@@ -63,11 +63,6 @@

         #region Properties

-        internal static float ZEye
-        {
-            get { return 1.192092896e-07F; }
-        }
-
         public CCCameraProjection Projection
         {
             get { return cameraProjection; }


circle by 2 tan line and 1 pt hold by one of given tans

--- src/Circle3D.cs
+++ src/Circle3D.cs
@@ -69,6 +69,29 @@
                 CS = new CoordinateSystem3D(c, p1 - c, p2 - c);
             }

+            /// <summary>
+            /// build 3d circle that tangent to lines t1,t2 and that intersects point p
+            /// note: point p must contained in one of t1,t2
+            /// circle will be inside region t1.V toward t2.V
+            /// </summary>
+            public Circle3D(double tol_len, Line3D t1, Line3D t2, Vector3D p)
+            {
+                var ip = t1.Intersect(tol_len, t2);
+                var angle = t1.V.AngleRad(tol_len, t2.V);
+                var t3 = new Line3D(ip, t1.V.RotateAs(tol_len, t1.V, t2.V, .5), Line3DConstructMode.PointAndVector);
+
+                Line3D lp = null;
+                if (t1.LineContainsPoint(tol_len, p)) lp = t1;
+                else if (t2.LineContainsPoint(tol_len, p)) lp = t2;
+                else throw new Exception($"circle 2 tan 1 point : pt must contained in one of given tan");
+
+                var lpp = new Line3D(p, lp.V.RotateAboutAxis(t1.V.CrossProduct(t2.V), PI / 2), Line3DConstructMode.PointAndVector);
+                var c = lpp.Intersect(tol_len, t3);
+
+                Radius = p.Distance(c);
+                CS = new CoordinateSystem3D(c, lpp.V, t2.Perpendicular(tol_len, c).V);
+            }
+
             public double Area { get { return PI * Radius * Radius; } }
             public double Length { get { return 2 * PI * Radius; } }


Remove confusing Prepend overload

Remove confusing Prepend overload

--- src/ConsList.cs
+++ src/ConsList.cs
@@ -113,10 +113,15 @@
             if (predicate == null) throw new ArgumentNullException(nameof(predicate));
             if (resultSelector == null) throw new ArgumentNullException(nameof(resultSelector));

-            return list.TakeWhile(predicate)
-                       .Aggregate((Head: ConsList<T>.Empty, Tail: list),
-                                  (ht, e) => (Cons(e, ht.Head), ht.Tail.Cdr),
-                                  ht => resultSelector(ConsList<T>.Empty.Prepend(ht.Head), ht.Tail));
+            List<T> cars = null;
+
+            foreach (var item in list.TakeWhile(predicate))
+            {
+                (cars ?? (cars = new List<T>())).Add(item);
+                list = list.Cdr;
+            }
+
+            return resultSelector(cars is List<T> hs ? From(hs) : ConsList<T>.Empty, list);
         }
     }

@@ -146,7 +151,7 @@
         public ConsList<T> Prepend(T item) =>
             new ConsList<T>(item, this);

-        public ConsList<T> Prepend(IEnumerable<T> items) =>
+        public ConsList<T> PrependAll(IEnumerable<T> items) =>
             items.Aggregate(this, (current, item) => current.Prepend(item));

         public ConsList<T> Concat(ConsList<T> list)


simple change

simple change

--- src/IconView.cs
+++ src/IconView.cs
@@ -173,7 +173,7 @@
 	public IconView (PhotoQuery query) : this ()
 	{
 		this.query = query;
-		query.Reload += new PhotoQuery.ReloadHandler (OnReload);
+		query.Reload += OnReload;
 	}

 	protected IconView (IntPtr raw) : base (raw) {}


Fix equality comparison and JSON output

Fix equality comparison and JSON output

--- src/JsonData.cs
+++ src/JsonData.cs
@@ -288,7 +288,9 @@
             else if (IsDictionary) {
                 builder.Append('{');
                 foreach (var entry in AsDictionary) {
+                    builder.Append('"');
                     builder.Append(entry.Key);
+                    builder.Append('"');
                     builder.Append(":");
                     entry.Value.BuildCompressedString(builder);
                     builder.Append(' ');
@@ -343,7 +345,9 @@
                 builder.AppendLine();
                 foreach (var entry in AsDictionary) {
                     InsertSpacing(builder, depth + 1);
+                    builder.Append('"');
                     builder.Append(entry.Key);
+                    builder.Append('"');
                     builder.Append(": ");
                     entry.Value.BuildPrettyString(builder, depth + 1);
                     builder.AppendLine();
@@ -407,35 +411,78 @@
         /// Determines whether the specified object is equal to the current object.
         /// </summary>
         public override bool Equals(object obj) {
-            if (obj == null) {
+            return Equals(obj as JsonData);
+        }
+
+        /// <summary>
+        /// Determines whether the specified object is equal to the current object.
+        /// </summary>
+        public bool Equals(JsonData other) {
+            if (other == null) {
                 return false;
             }

-            var v = obj as JsonData;
-            if (v == null) {
-                return false;
-            }
-
-            if (_value == null) {
-                return v._value == null;
-            }
-
-            return _value.Equals(v._value);
-        }
-
-        /// <summary>
-        /// Determines whether the specified object is equal to the current object.
-        /// </summary>
-        public bool Equals(JsonData v) {
-            if (v == null) {
-                return false;
-            }
-
-            if (_value == null) {
-                return v._value == null;
-            }
-
-            return _value.Equals(v._value);
+            if (IsNull) {
+                return other.IsNull;
+            }
+
+            if (IsFloat) {
+                return
+                    other.IsFloat &&
+                    AsFloat == other.AsFloat;
+            }
+
+            if (IsBool) {
+                return
+                    other.IsBool &&
+                    AsBool == other.AsBool;
+            }
+
+            if (IsString) {
+                return
+                    other.IsString &&
+                    AsString == other.AsString;
+            }
+
+            if (IsList) {
+                if (other.IsList == false) return false;
+
+                var thisList = AsList;
+                var otherList = other.AsList;
+
+                if (thisList.Count != otherList.Count) return false;
+
+                for (int i = 0; i < thisList.Count; ++i) {
+                    if (thisList[i].Equals(otherList[i]) == false) {
+                        return false;
+                    }
+                }
+
+                return true;
+            }
+
+            if (IsDictionary) {
+                if (other.IsDictionary == false) return false;
+
+                var thisDict = AsDictionary;
+                var otherDict = other.AsDictionary;
+
+                if (thisDict.Count != otherDict.Count) return false;
+
+                foreach (string key in thisDict.Keys) {
+                    if (otherDict.ContainsKey(key) == false) {
+                        return false;
+                    }
+
+                    if (thisDict[key].Equals(otherDict[key]) == false) {
+                        return false;
+                    }
+                }
+
+                return true;
+            }
+
+            throw new Exception("Unknown data type");
         }

         /// <summary>


only validate on post and put

only validate on post and put

--- src/NCDO/CDO.cs
+++ src/NCDO/CDO.cs
@@ -549,7 +549,8 @@
             cancellationToken.ThrowIfCancellationRequested();
             ThrowIfDisposed();

-            if (cDORequest.Method != HttpMethod.Get)
+            //modelvalidation
+            if (cDORequest.Method == HttpMethod.Post || cDORequest.Method == HttpMethod.Put)
             {
                 var args = cDORequest.ObjParam.Get("request") as JsonObject ?? cDORequest.ObjParam as JsonObject;
                 if (args != null)


Ignore failure when deleting feature-scripts

--- source/Calamari/Deployment/Conventions/FeatureScriptConvention.cs
+++ source/Calamari/Deployment/Conventions/FeatureScriptConvention.cs
@@ -62,7 +62,7 @@
                 var result = scriptEngineSelector.SelectEngine(scriptFile).Execute(scriptFile, deployment.Variables, commandLineRunner);

                 // And then delete it
-                fileSystem.DeleteFile(scriptFile, DeletionOptions.TryThreeTimes);
+                fileSystem.DeleteFile(scriptFile, DeletionOptions.TryThreeTimesIgnoreFailure);

                 if (result.ExitCode != 0)
                 {


write some document for Session-valuetype-extensions

--- src/Alamut.Utilities.AspNet/Session/SessionValueTypeExtensions.cs
+++ src/Alamut.Utilities.AspNet/Session/SessionValueTypeExtensions.cs
@@ -10,11 +10,11 @@
     public static class SessionValueTypeExtensions
     {
         /// <summary>
-        /// set a Value-Type in Session object
+        /// Set the given key and value (only value-type) in the current session
         /// </summary>
         /// <param name="session"></param>
-        /// <param name="key"></param>
-        /// <param name="value"></param>
+        /// <param name="key">the session key</param>
+        /// <param name="value">the session value</param>
         public static void Set(this ISession session, string key, object value)
         {
             switch (value)
@@ -68,56 +68,100 @@
                 }
         }

+        /// <summary>
+        /// Retrieve the value of the given key, if present.
+        /// otherwise, return false
+        /// </summary>
         public static bool? GetBool(this ISession session, string key) =>
             session.TryGetValue(key, out byte[] value)
                 ? BitConverter.ToBoolean(value, 0)
                 : (bool?)null;

+        /// <summary>
+        /// Retrieve the value of the given key, if present.
+        /// otherwise, return false
+        /// </summary>
         public static char? GetChar(this ISession session, string key) =>
             session.TryGetValue(key, out byte[] value)
                 ? BitConverter.ToChar(value, 0)
                 : (char?)null;

+        /// <summary>
+        /// Retrieve the value of the given key, if present.
+        /// otherwise, return false
+        /// </summary>
          public static double? GetDouble(this ISession session, string key) =>
             session.TryGetValue(key, out byte[] value)
                 ? BitConverter.ToDouble(value, 0)
                 : (double?)null;

+        /// <summary>
+        /// Retrieve the value of the given key, if present.
+        /// otherwise, return false
+        /// </summary>
         public static short? GetShort(this ISession session, string key) =>
             session.TryGetValue(key, out byte[] value)
                 ? BitConverter.ToInt16(value, 0)
                 : (short?)null;

+        /// <summary>
+        /// Retrieve the value of the given key, if present.
+        /// otherwise, return false
+        /// </summary>
         public static int? GetInt(this ISession session, string key) =>
             session.TryGetValue(key, out byte[] value)
                 ? BitConverter.ToInt32(value, 0)
                 : (int?)null;

+        /// <summary>
+        /// Retrieve the value of the given key, if present.
+        /// otherwise, return false
+        /// </summary>
         public static long? GetLong(this ISession session, string key) =>
             session.TryGetValue(key, out byte[] value)
                 ? BitConverter.ToInt64(value, 0)
                 : (long?)null;

+        /// <summary>
+        /// Retrieve the value of the given key, if present.
+        /// otherwise, return false
+        /// </summary>
         public static float? GetFloat(this ISession session, string key) =>
             session.TryGetValue(key, out byte[] value)
                 ? BitConverter.ToSingle(value, 0)
                 : (float?)null;

+        /// <summary>
+        /// Retrieve the value of the given key, if present.
+        /// otherwise, return false
+        /// </summary>
         public static ushort? GetUShort(this ISession session, string key) =>
             session.TryGetValue(key, out byte[] value)
                 ? BitConverter.ToUInt16(value, 0)
                 : (ushort?)null;
-
+
+        /// <summary>
+        /// Retrieve the value of the given key, if present.
+        /// otherwise, return false
+        /// </summary>
         public static uint? GetUInt(this ISession session, string key) =>
             session.TryGetValue(key, out byte[] value)
                 ? BitConverter.ToUInt32(value, 0)
                 : (uint?)null;

+        /// <summary>
+        /// Retrieve the value of the given key, if present.
+        /// otherwise, return false
+        /// </summary>
         public static ulong? GetULong(this ISession session, string key) =>
             session.TryGetValue(key, out byte[] value)
                 ? BitConverter.ToUInt64(value, 0)
                 : (ulong?)null;

+        /// <summary>
+        /// Retrieve the value of the given key, if present.
+        /// otherwise, return false
+        /// </summary>
         public static DateTime? GetDateTime(this ISession session, string key) =>
             session.TryGetValue(key, out byte[] value)
                 ? new DateTime(BitConverter.ToInt64(value, 0))


Removed unnecessary code

Removed unnecessary code

--- src/Apps/NetDevPL.Apps.WebApp/Features/Facebook/FacebookModule.cs
+++ src/Apps/NetDevPL.Apps.WebApp/Features/Facebook/FacebookModule.cs
@@ -14,8 +14,6 @@
         {
             Get["/facebook"] = parameters =>
             {
-                var karma = new NetDevPL.Features.Reporting.FacebookStats().UserKarma();
-
                 var posts = _facebookDataRepository.PostsGetList();

                 return View["facebookPosts", new FacebookPostsViewModel(posts)];
@@ -39,4 +37,4 @@

         public HLListPage<FacebookPost> Posts { get; set; }
     }
-}+}


Fixed the word highlighting

Fixed the word highlighting

--- Assets/Code/Controller.cs
+++ Assets/Code/Controller.cs
@@ -11,7 +11,8 @@

 	private RandomText generator;

-	private string[] currentText;
+	private string[] originalText;
+	private string[] shownText;
 	private int index;

 	private string[] words = new string[] { "ik", "hallo", "je", "het", "een", "goed", "van", "en", "is", "voor",
@@ -34,9 +35,10 @@
 		generator = new RandomText(words);
 		generator.AddContentParagraphs(1, 1, 1, 100, 1000);

-		currentText = generator.Content.Split(' ');
-		currentText[index] = "" + currentText[index] + "";
-		textField.text = string.Join(" ", currentText);
+		originalText = generator.Content.Split(' ');
+		shownText = (string[])originalText.Clone();
+		shownText[index] = "" + shownText[index] + "";
+		textField.text = string.Join(" ", shownText);
 	}

 	char Validate(char c)
@@ -51,22 +53,23 @@

 	void Submit()
 	{
-		currentText = textField.text.Split(' ');
+		shownText = textField.text.Split(' ');

-		// Check if the typed text is the same as the shown text.
-		if (inputField.text == currentText[index].Replace("", string.Empty).Replace("", string.Empty))
+		// Check if the typed word is the same as the corresponding word.
+		if (inputField.text == originalText[index])
 		{
-			currentText[index] = "<color=green>" + currentText[index].Replace("", string.Empty).Replace("", string.Empty) + "</color>";
+			shownText[index] = "<color=green>" + originalText[index] + "</color>";
 		}
 		else
 		{
-			currentText[index] = "<color=red>" + currentText[index].Replace("", string.Empty).Replace("", string.Empty) + "</color>";
+			shownText[index] = "<color=red>" + originalText[index] + "</color>";
 		}

-		currentText[index + 1] = "" + currentText[index + 1] + "";
+		// Highlight next word.
+		shownText[index + 1] = "" + originalText[index + 1] + "";
+		textField.text = string.Join(" ", shownText);

-		textField.text = string.Join(" ", currentText);
 		index++;
-		inputField.text = "";
+		inputField.text = string.Empty;
 	}
 }


Added missing documentation.

Added missing documentation.

--- src/BadgesSharp.Infrastructure/Repositories/FirebaseRepository.cs
+++ src/BadgesSharp.Infrastructure/Repositories/FirebaseRepository.cs
@@ -2,8 +2,6 @@
 using System.Collections.Generic;
 using System.Linq;
 using System.Linq.Expressions;
-using System.Text;
-using System.Threading.Tasks;
 using FireSharp;
 using FireSharp.Config;
 using FireSharp.Interfaces;
@@ -13,7 +11,10 @@

 namespace BadgesSharp.Infrastructure.Repositories
 {
-    public class FirebaseRepository<TEntity> : RepositoryBase<TEntity>, IRepository<TEntity>
+	/// <summary>
+	/// Firebase repository.
+	/// </summary>
+	public class FirebaseRepository<TEntity> : RepositoryBase<TEntity>, IRepository<TEntity>
         where TEntity : IAggregateRoot, new()
     {
         #region Fields
@@ -22,6 +23,9 @@
         #endregion

         #region Constructors
+		/// <summary>
+		/// Initializes the <see cref="T:BadgesSharp.Infrastructure.Repositories.FirebaseRepository`1"/> class.
+		/// </summary>
         static FirebaseRepository()
         {
             var config = new FirebaseConfig
@@ -43,12 +47,24 @@
             m_rootPath = typeof(TEntity).Name;
         }

-        public override long CountAll(Expression<Func<TEntity, bool>> filter)
+		/// <summary>
+		/// Counts all entities that matches the filter.
+		/// </summary>
+		/// <returns>The number of the entities that matches the filter.</returns>
+		/// <param name="filter">The filter.</param>
+		public override long CountAll(Expression<Func<TEntity, bool>> filter)
         {
             return FindAll(0, int.MaxValue, (b) => true).Count();
         }

-        public override IEnumerable<TEntity> FindAll(int offset, int limit, Expression<Func<TEntity, bool>> filter)
+		/// <summary>
+		/// Finds all entities that matches the filter.
+		/// </summary>
+		/// <returns>The found entities.</returns>
+		/// <param name="offset">The offset to start the result.</param>
+		/// <param name="limit">The result count limit.</param>
+		/// <param name="filter">The entities filter.</param>
+		public override IEnumerable<TEntity> FindAll(int offset, int limit, Expression<Func<TEntity, bool>> filter)
         {
             var response = s_client.Get(m_rootPath);

@@ -64,34 +80,69 @@
             .Take(limit);
         }

-        public override IEnumerable<TEntity> FindAllAscending<TKey>(int offset, int limit, Expression<Func<TEntity, bool>> filter, Expression<Func<TEntity, TKey>> orderBy)
+		/// <summary>
+		/// Finds all entities that matches the filter in a ascending order.
+		/// </summary>
+		/// <returns>The found entities.</returns>
+		/// <param name="offset">The offset to start the result.</param>
+		/// <param name="limit">The result count limit.</param>
+		/// <param name="filter">The entities filter.</param>
+		/// <param name="orderBy">The order.</param>
+		/// <typeparam name="TKey">The 1st type parameter.</typeparam>
+		public override IEnumerable<TEntity> FindAllAscending<TKey>(int offset, int limit, Expression<Func<TEntity, bool>> filter, Expression<Func<TEntity, TKey>> orderBy)
         {
             throw new NotImplementedException();
         }

-        public override IEnumerable<TEntity> FindAllDescending<TKey>(int offset, int limit, Expression<Func<TEntity, bool>> filter, Expression<Func<TEntity, TKey>> orderBy)
+		/// <summary>
+		/// Finds all entities that matches the filter in a descending order.
+		/// </summary>
+		/// <returns>The found entities.</returns>
+		/// <param name="offset">The offset to start the result.</param>
+		/// <param name="limit">The result count limit.</param>
+		/// <param name="filter">The entities filter.</param>
+		/// <param name="orderBy">The order.</param>
+		/// <typeparam name="TKey">The 1st type parameter.</typeparam>
+		public override IEnumerable<TEntity> FindAllDescending<TKey>(int offset, int limit, Expression<Func<TEntity, bool>> filter, Expression<Func<TEntity, TKey>> orderBy)
         {
             throw new NotImplementedException();
         }

-        public override TEntity FindBy(object key)
+		/// <summary>
+		/// Finds the entity by the key.
+		/// </summary>
+		/// <returns>The found entity.</returns>
+		/// <param name="key">The key.</param>
+		public override TEntity FindBy(object key)
         {
             return FindAll(0, 1, f => f.Key == key).FirstOrDefault();
         }

-        protected override void PersistDeletedItem(TEntity item)
+		/// <summary>
+		/// Persists the deleted item.
+		/// </summary>
+		/// <param name="item">The item.</param>
+		protected override void PersistDeletedItem(TEntity item)
         {
             s_client.Delete(GetEntityPath(item));
         }

-        protected override void PersistNewItem(TEntity item)
+		/// <summary>
+		/// Persists the new item.
+		/// </summary>
+		/// <param name="item">The item.</param>
+		protected override void PersistNewItem(TEntity item)
         {
             var response = s_client.Push(GetEntityPath(item), item);
             var entityCreated = response.ResultAs<TEntity>();
             item.Key = entityCreated.Key;
         }

-        protected override void PersistUpdatedItem(TEntity item)
+		/// <summary>
+		/// Persists the updated item.
+		/// </summary>
+		/// <param name="item">The item.</param>
+		protected override void PersistUpdatedItem(TEntity item)
         {
             s_client.Update(GetEntityPath(item), item);
         }


Exception for missing WorldInfo

Exception for missing WorldInfo

--- Assets/Scripts/Respawn.cs
+++ Assets/Scripts/Respawn.cs
@@ -1,5 +1,4 @@
 using UnityEngine;
-using System.Collections;

 //Player resets to one of these points if r is pressed, handeled by WorldInfo
 public class Respawn : MonoBehaviour
@@ -14,6 +13,9 @@
 	{
 		if(isFistSpawn)
 		{
+            if (WorldInfo.info == null)
+                throw new System.InvalidOperationException("This scene does not have a WoldInfo object! Game can not initialize.");
+
 			WorldInfo.info.setSpawn(this);
 		}
 	}


Fixing error.

Fixing error.

--- Assets/Scripts/Spawner.cs
+++ Assets/Scripts/Spawner.cs
@@ -68,14 +68,14 @@
 		//Finally, initialize server only stuff or client only stuff.
 		//Also, finally found a use-case for [Server] / [ServerCallback]. Simplifies things a bit.

-		GameObject cam = null;
+		GameObject mainCam = null;
 		foreach (GameObject camObj in cameraObjects) {
 			if (camObj.Equals(Camera.main)) {
-				cam = camObj;
+				mainCam = camObj;
 				break;
 			}
 		}
-		ServerInitialize(cam);
+		ServerInitialize(mainCam);
 	}

 	[ServerCallback]


AriClient: catch and report all exceptions that occur inside an event handler

--- AsterNET.ARI/ARIClient.cs
+++ AsterNET.ARI/ARIClient.cs
@@ -170,13 +170,21 @@

             lock (_syncRoot)
             {
-                if (_dispatcher != null)
+                if (_dispatcher == null)
+                    return;
+
+                _dispatcher.QueueAction(() =>
                 {
-                    _dispatcher.QueueAction(() =>
+                    try
                     {
                         FireEvent(evnt.Type, evnt, this);
-                    });
-                }
+                    }
+                    catch
+                    {
+						// Handle any exceptions that were thrown by the invoked event handler
+						Console.WriteLine("An event listener went kaboom!");
+                    }
+                });
             }
         }


Fix PublishingWeb incorrect SuperUserSite issue

--- src/Codeless.SharePoint/SharePoint/Publishing/VariationContext.cs
+++ src/Codeless.SharePoint/SharePoint/Publishing/VariationContext.cs
@@ -75,28 +75,44 @@
     public CultureInfo Culture { get; private set; }

     private void InitializeObject(SPWeb web) {
-      if (PublishingWeb.IsPublishingWeb(web)) {
-        PublishingWeb currentWeb = PublishingWeb.GetPublishingWeb(web);
-        VariationLabel currentLabel = GetVariationLabel(currentWeb);
-        if (currentLabel != null) {
-          this.IsVariationWeb = true;
-          this.IsSource = currentLabel.IsSource;
-          this.TopWebServerRelativeUrl = new Uri(currentLabel.TopWebUrl).AbsolutePath;
-          this.VariationLabel = currentLabel.Title;
-          this.PagesListName = currentWeb.PagesListName;
-          int lcid;
-          if (Int32.TryParse(currentLabel.Locale, out lcid)) {
-            this.Culture = CultureInfo.GetCultureInfo(lcid);
-          } else {
-            this.Culture = CultureInfo.GetCultureInfo(currentLabel.Language);
+      SPSite cachedSuperUserSite = null;
+      if (HttpContext.Current != null) {
+        cachedSuperUserSite = HttpContext.Current.Items["SuperUserSite"] as SPSite;
+        if (cachedSuperUserSite != null && cachedSuperUserSite.ID != web.Site.ID) {
+          HttpContext.Current.Items["SuperUserSite"] = null;
+        }
+      }
+      try {
+        if (PublishingWeb.IsPublishingWeb(web)) {
+          PublishingWeb currentWeb = PublishingWeb.GetPublishingWeb(web);
+          VariationLabel currentLabel = GetVariationLabel(currentWeb);
+          if (currentLabel != null) {
+            this.IsVariationWeb = true;
+            this.IsSource = currentLabel.IsSource;
+            this.TopWebServerRelativeUrl = new Uri(currentLabel.TopWebUrl).AbsolutePath;
+            this.VariationLabel = currentLabel.Title;
+            this.PagesListName = currentWeb.PagesListName;
+            int lcid;
+            if (Int32.TryParse(currentLabel.Locale, out lcid)) {
+              this.Culture = CultureInfo.GetCultureInfo(lcid);
+            } else {
+              this.Culture = CultureInfo.GetCultureInfo(currentLabel.Language);
+            }
           }
         }
-      }
-      if (!this.IsVariationWeb) {
-        this.TopWebServerRelativeUrl = web.Site.ServerRelativeUrl;
-        this.VariationLabel = String.Empty;
-        this.PagesListName = "Pages";
-        this.Culture = web.UICulture;
+        if (!this.IsVariationWeb) {
+          this.TopWebServerRelativeUrl = web.Site.ServerRelativeUrl;
+          this.VariationLabel = String.Empty;
+          this.PagesListName = "Pages";
+          this.Culture = web.UICulture;
+        }
+      } finally {
+        // avoid messing up calls to publishing web API in the same HTTP request (FileNotFoundException)
+        // where SuperUserSite should be reserved for current site collection
+        // https://sharepoint.stackexchange.com/questions/83242
+        if (HttpContext.Current != null && (cachedSuperUserSite == null || cachedSuperUserSite.ID != web.Site.ID)) {
+          HttpContext.Current.Items["SuperUserSite"] = cachedSuperUserSite;
+        }
       }
     }


Properties pointing to themself in the '<see>' tag (#50896)

Properties with the same name as the returned type point to themself in the '<see>' tag instead of the actual type.

--- src/Compilers/Core/Portable/SourceGeneration/GeneratorContexts.cs
+++ src/Compilers/Core/Portable/SourceGeneration/GeneratorContexts.cs
@@ -33,7 +33,7 @@
         }

         /// <summary>
-        /// Get the current <see cref="Compilation"/> at the time of execution.
+        /// Get the current <see cref="CodeAnalysis.Compilation"/> at the time of execution.
         /// </summary>
         /// <remarks>
         /// This compilation contains only the user supplied code; other generated code is not
@@ -43,7 +43,7 @@
         public Compilation Compilation { get; }

         /// <summary>
-        /// Get the <see cref="ParseOptions"/> that will be used to parse any added sources.
+        /// Get the <see cref="CodeAnalysis.ParseOptions"/> that will be used to parse any added sources.
         /// </summary>
         public ParseOptions ParseOptions { get; }

@@ -68,7 +68,7 @@
         public ISyntaxContextReceiver? SyntaxContextReceiver { get; }

         /// <summary>
-        /// A <see cref="CancellationToken"/> that can be checked to see if the generation should be cancelled.
+        /// A <see cref="System.Threading.CancellationToken"/> that can be checked to see if the generation should be cancelled.
         /// </summary>
         public CancellationToken CancellationToken { get; }

@@ -111,7 +111,7 @@
         }

         /// <summary>
-        /// A <see cref="CancellationToken"/> that can be checked to see if the initialization should be cancelled.
+        /// A <see cref="System.Threading.CancellationToken"/> that can be checked to see if the initialization should be cancelled.
         /// </summary>
         public CancellationToken CancellationToken { get; }

@@ -213,7 +213,7 @@
         public SyntaxNode Node { get; }

         /// <summary>
-        /// The <see cref="SemanticModel" /> that can be queried to obtain information about <see cref="Node"/>.
+        /// The <see cref="CodeAnalysis.SemanticModel" /> that can be queried to obtain information about <see cref="Node"/>.
         /// </summary>
         public SemanticModel SemanticModel { get; }
     }
@@ -232,7 +232,7 @@
         }

         /// <summary>
-        /// A <see cref="CancellationToken"/> that can be checked to see if the PostInitialization should be cancelled.
+        /// A <see cref="System.Threading.CancellationToken"/> that can be checked to see if the PostInitialization should be cancelled.
         /// </summary>
         public CancellationToken CancellationToken { get; }


IncrementStrategyFinder: Improve DetermineIncrementedField() performance

This optimizes a hot path under BaseVersionCalculator.GetBaseVersion(),
which among other things analyses commit messages on the sequence of
commits from candidate base versions to HEAD.  Candidate base versions
can include all version tags in the repository.

The previous implementation did an iteration of the full sequence of
commits from beginning to HEAD (which can number in the tens of
thousands or more) to get the commit subsequence for each of the
candidate base versions (which can number in the thousands, especially
in continuous deployment situations), so effectively a nested loop,
which quickly reached huge numbers of iterations as the number of
commits and tags in a repo increased.  Even though the commit message
analysis work itself was already being cached and therefore not
repeated, just the iteration itself could take significant amounts of
time.

The new implementation maintains a cache of the full sequence of commits
to HEAD (as the old one did, except as an array and with simpler code)
plus a lookup indexing into that sequence by commit sha.  To get the
subsequence for each base version, we get its position in the full
sequence via the lookup and yield a zero-allocation ArraySegment from
there to the end.  This eliminates the nested loop, reducing the whole
thing to essentially a linear iteration over the base versions (tags).

On a real-world repo with ~20,000 commits and ~5,000 tags, this brings
the run time down from around 30 seconds to around 20 seconds.

--- src/GitVersion.Core/VersionCalculation/IncrementStrategyFinder.cs
+++ src/GitVersion.Core/VersionCalculation/IncrementStrategyFinder.cs
@@ -1,3 +1,4 @@
+using System;
 using System.Collections.Concurrent;
 using System.Collections.Generic;
 using System.Linq;
@@ -21,8 +22,9 @@
         public const string DefaultNoBumpPattern = @"\+semver:\s?(none|skip)";

         private static readonly ConcurrentDictionary<string, Regex> CompiledRegexCache = new();
-        private IEnumerable<ICommit>? intermediateCommitCache;
         private readonly Dictionary<string, VersionField?> commitIncrementCache = new();
+        private readonly Dictionary<string, Dictionary<string, int>> headCommitsMapCache = new();
+        private readonly Dictionary<string, ICommit[]> headCommitsCache = new();

         private static readonly Regex DefaultMajorPatternRegex = new(DefaultMajorPattern, RegexOptions.Compiled | RegexOptions.IgnoreCase);
         private static readonly Regex DefaultMinorPatternRegex = new(DefaultMinorPattern, RegexOptions.Compiled | RegexOptions.IgnoreCase);
@@ -31,7 +33,8 @@

         public VersionField? DetermineIncrementedField(IGitRepository repository, GitVersionContext context, BaseVersion baseVersion)
         {
-            var commitMessageIncrement = FindCommitMessageIncrement(repository, context, baseVersion);
+            var commitMessageIncrement = FindCommitMessageIncrement(repository, context, baseVersion.BaseVersionSource);
+
             var defaultIncrement = context.Configuration?.Increment.ToVersionField();

             // use the default branch config increment strategy if there are no commit message overrides
@@ -77,14 +80,16 @@
             return null;
         }

-        private VersionField? FindCommitMessageIncrement(IGitRepository repository, GitVersionContext context, BaseVersion baseVersion)
+        private VersionField? FindCommitMessageIncrement(IGitRepository repository, GitVersionContext context, ICommit? baseCommit)
         {
+            if (baseCommit == null) return null;
+
             if (context.Configuration?.CommitMessageIncrementing == CommitMessageIncrementMode.Disabled)
             {
                 return null;
             }

-            var commits = GetIntermediateCommits(repository, baseVersion.BaseVersionSource, context.CurrentCommit);
+            var commits = GetIntermediateCommits(repository, baseCommit, context.CurrentCommit);

             if (context.Configuration?.CommitMessageIncrementing == CommitMessageIncrementMode.MergeMessageOnly)
             {
@@ -104,28 +109,36 @@
             return CompiledRegexCache.GetOrAdd(messageRegex, pattern => new Regex(pattern, RegexOptions.Compiled | RegexOptions.IgnoreCase));
         }

-        private IEnumerable<ICommit> GetIntermediateCommits(IGitRepository repo, ICommit? baseCommit, ICommit? headCommit)
+        /// <summary>
+        /// Get the sequence of commits in a <paramref name="repo"/> between a <paramref name="baseCommit"/> (exclusive)
+        /// and a particular <paramref name="headCommit"/> (inclusive)
+        /// </summary>
+        private IEnumerable<ICommit> GetIntermediateCommits(IGitRepository repo, ICommit baseCommit, ICommit? headCommit)
         {
-            if (baseCommit == null) yield break;
+            var map = GetHeadCommitsMap(repo, headCommit);
+            if (!map.TryGetValue(baseCommit.Sha, out var baseIndex)) return Enumerable.Empty<ICommit>();
+            var commitAfterBaseIndex = baseIndex + 1;
+            var headCommits = GetHeadCommits(repo, headCommit);
+            return new ArraySegment<ICommit>(headCommits, commitAfterBaseIndex, headCommits.Length - commitAfterBaseIndex);
+        }

-            var commitCache = this.intermediateCommitCache;
+        /// <summary>
+        /// Get a mapping of commit shas to their zero-based position in the sequence of commits from the beginning of a
+        /// <paramref name="repo"/> to a particular <paramref name="headCommit"/>
+        /// </summary>
+        private Dictionary<string, int> GetHeadCommitsMap(IGitRepository repo, ICommit? headCommit) =>
+            this.headCommitsMapCache.GetOrAdd(headCommit?.Sha ?? "NULL", () =>
+                GetHeadCommits(repo, headCommit)
+                    .Select((commit, index) => (Sha: commit.Sha, Index: index))
+                    .ToDictionary(t => t.Sha, t => t.Index));

-            if (commitCache == null || !Equals(commitCache.LastOrDefault(), headCommit))
-            {
-                commitCache = GetCommitsReacheableFromHead(repo, headCommit).ToList();
-                this.intermediateCommitCache = commitCache;
-            }
-
-            var found = false;
-            foreach (var commit in commitCache)
-            {
-                if (found)
-                    yield return commit;
-
-                if (commit.Sha == baseCommit.Sha)
-                    found = true;
-            }
-        }
+        /// <summary>
+        /// Get the sequence of commits from the beginning of a <paramref name="repo"/> to a particular
+        /// <paramref name="headCommit"/> (inclusive)
+        /// </summary>
+        private ICommit[] GetHeadCommits(IGitRepository repo, ICommit? headCommit) =>
+            this.headCommitsCache.GetOrAdd(headCommit?.Sha ?? "NULL", () =>
+                GetCommitsReacheableFromHead(repo, headCommit).ToArray());

         private VersionField? GetIncrementFromCommit(ICommit commit, Regex majorRegex, Regex minorRegex, Regex patchRegex, Regex none) =>
             this.commitIncrementCache.GetOrAdd(commit.Sha, () =>
@@ -140,6 +153,10 @@
             return null;
         }

+        /// <summary>
+        /// Query a <paramref name="repo"/> for the sequence of commits from the beginning to a particular
+        /// <paramref name="headCommit"/> (inclusive)
+        /// </summary>
         private static IEnumerable<ICommit> GetCommitsReacheableFromHead(IGitRepository repo, ICommit? headCommit)
         {
             var filter = new CommitFilter