Background works

Background works

Used Lynn's code

--- OneBullet/OneBullet/Game1.cs
+++ OneBullet/OneBullet/Game1.cs
@@ -397,8 +397,8 @@

 			// TODO: Add your drawing code here
 			spriteBatch.Begin();
-			spriteBatch.Draw(background, new Vector2(0, 0), Color.White);
-			spriteBatch.Draw(backgroundElements, new Vector2(0, 0), Color.White);
+			spriteBatch.Draw(background, new Rectangle(0, 0, graphics.PreferredBackBufferWidth, graphics.PreferredBackBufferHeight), Color.White);
+			spriteBatch.Draw(backgroundElements, new Rectangle(0, 0, graphics.PreferredBackBufferWidth, graphics.PreferredBackBufferHeight), Color.White);
 			player1.Draw(spriteBatch);
 			player2.Draw(spriteBatch);
 			bullet1.Draw(spriteBatch);


Fixed some documentation and code artifacts left from previous commit

git-svn-id: e915c4f8b2ea2a6e63cbe989b51c0994a698cc26@2550 52acb1d6-8a22-11de-b505-999d5b087335

--- OpenMetaverse/GridManager.cs
+++ OpenMetaverse/GridManager.cs
@@ -193,6 +193,8 @@
         ///
         /// </summary>
         /// <param name="sim"></param>
+        /// <param name="newEntries"></param>
+        /// <param name="removedEntries"></param>
         public delegate void CoarseLocationUpdateCallback(Simulator sim, List<UUID> newEntries, List<UUID> removedEntries);
         /// <summary>
         ///
@@ -252,7 +254,6 @@
         private float sunPhase;
         private Vector3 sunDirection;
         private Vector3 sunAngVelocity;
-        private DateTime worldTime;

         /// <summary>
         /// Constructor


Fixed issues on HyperV Agent code for  shared network VR issues

--- plugins/hypervisors/hyperv/DotNet/ServerResource/HypervResource/WmiCallsV2.cs
+++ plugins/hypervisors/hyperv/DotNet/ServerResource/HypervResource/WmiCallsV2.cs
@@ -431,7 +431,15 @@
                 System.Threading.Thread.Sleep(90000);
                 SetState(newVm, RequiredState.Reset);
                 // wait for the second boot and then return with sucesss
-                pingResource(publicIpAddress);
+                //if publicIPAddress is empty or null don't ping the ip
+                if (publicIpAddress.Equals("") == true)
+                {
+                    System.Threading.Thread.Sleep(90000);
+                }
+                else
+                {
+                    pingResource(publicIpAddress);
+                }
             }
             logger.InfoFormat("Started VM {0}", vmName);
             return newVm;


don't dispose autofac container extension #1704 (#1758)

--- src/Client/Xamarin/Bit.Client.Xamarin.Prism/Autofac/AutofacContainerExtension.cs
+++ src/Client/Xamarin/Bit.Client.Xamarin.Prism/Autofac/AutofacContainerExtension.cs
@@ -95,7 +95,7 @@
         }
     }

-    public class AutofacContainerExtension : IAutofacContainerExtension, IDisposable
+    public class AutofacContainerExtension : IAutofacContainerExtension
     {
         private AutofacScopeProvider _currentScope;
         private AutofacScopeProvider _rootScope;
@@ -253,26 +253,5 @@
             _currentScope = new AutofacScopeProvider(child);
             return _currentScope;
         }
-
-        private bool isDisposed;
-
-        public virtual void Dispose()
-        {
-            Dispose(true);
-            GC.SuppressFinalize(this);
-        }
-
-        protected virtual void Dispose(bool disposing)
-        {
-            if (isDisposed) return;
-            _currentScope?.Dispose();
-            _currentScope = null!;
-            isDisposed = true;
-        }
-
-        ~AutofacContainerExtension()
-        {
-            Dispose(false);
-        }
     }
 }


Removes editable wrappers from keywords

Removes editable wrappers from keywords

--- src/Mvc/Dinamico/Dinamico/Themes/Default/Views/Shared/LayoutPartials/Head.cshtml
+++ src/Mvc/Dinamico/Dinamico/Themes/Default/Views/Shared/LayoutPartials/Head.cshtml
@@ -5,9 +5,9 @@

 <meta name="viewport" content="width=device-width, initial-scale=1.0" />

-@Content.Register.Meta("Author").Container("Metadata").Display()
-@Content.Register.Meta("Keywords").Container("Metadata").Display()
-@Content.Register.Meta("Description").Container("Metadata").Display()
+@Content.Register.Meta("Author").Container("Metadata").Display().Editable(false)
+@Content.Register.Meta("Keywords").Container("Metadata").Display().Editable(false)
+@Content.Register.Meta("Description").Container("Metadata").Display().Editable(false)

 <link href="@Url.ThemedContent("~/Content/Site.css")" rel="stylesheet" type="text/css" />
 <link rel="shortcut icon" href="@Url.ThemedContent("~/favicon.ico")" />


Added hashedaccountid propagation to pensions reg controller

--- src/SFA.DAS.EmployerAccounts.Web/Controllers/SearchPensionRegulatorController.cs
+++ src/SFA.DAS.EmployerAccounts.Web/Controllers/SearchPensionRegulatorController.cs
@@ -99,7 +99,8 @@
         }

         [HttpGet]
-        [Route("pensionregulator/aorn")]
+        [Route("{HashedAccountId}/pensionregulator/aorn", Order = 0)]
+        [Route("pensionregulator/aorn", Order = 1)]
         public async Task<ActionResult> SearchPensionRegulatorByAorn(string payeRef, string aorn)
         {
             var userRef = OwinWrapper.GetClaimValue(ControllerConstants.UserRefClaimKeyName);
@@ -132,7 +133,8 @@

         [HttpPost]
         [ValidateAntiForgeryToken]
-        [Route("pensionregulator/aorn")]
+        [Route("{HashedAccountId}/pensionregulator/aorn", Order = 0)]
+        [Route("pensionregulator/aorn", Order = 1)]
         public async Task<ActionResult> SearchPensionRegulatorByAorn(SearchPensionRegulatorByAornViewModel viewModel)
         {
             ValidateAndFormatSearchPensionRegulatorByAornViewModel(viewModel);


Skip synonym tests while permissions are unavailable.

--- src/SJP.Schematic.Oracle.Tests/Integration/OracleDatabaseSynonymProviderTests.cs
+++ src/SJP.Schematic.Oracle.Tests/Integration/OracleDatabaseSynonymProviderTests.cs
@@ -9,6 +9,7 @@

 namespace SJP.Schematic.Oracle.Tests.Integration;

+[Ignore("Disabling until synonym permissions available in CI tests")]
 internal sealed class OracleDatabaseSynonymProviderTests : OracleTest
 {
     private IDatabaseSynonymProvider SynonymProvider => new OracleDatabaseSynonymProvider(DbConnection, IdentifierDefaults, IdentifierResolver);


Make _fileName readonly

Make _fileName readonly

--- src/System.Diagnostics.FileVersionInfo/src/System/Diagnostics/FileVersionInfo.cs
+++ src/System.Diagnostics.FileVersionInfo/src/System/Diagnostics/FileVersionInfo.cs
@@ -15,7 +15,7 @@
     /// </summary>
     public sealed class FileVersionInfo
     {
-        private string _fileName;
+        private readonly string _fileName;
         private string _companyName;
         private string _fileDescription;
         private string _fileVersion;


fix merge issues

fix merge issues

--- src/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/HttpConnectionPool.cs
+++ src/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/HttpConnectionPool.cs
@@ -261,10 +261,10 @@
                             // be signaled with the created connection when one is returned or
                             // space is available and the provided creation func has successfully
                             // created the connection to be used.
-                            if (NetEventSource.IsEnabled) Trace("Limit reached.  Waiting to create new connection.");
-                            var waiter = new ConnectionWaiter(this, request, cancellationToken);
+                            if (NetEventSource.IsEnabled) Trace("Connection limit reached, enqueuing waiter.");
+                            var waiter = new ConnectionWaiter();
                             EnqueueWaiter(waiter);
-                            return waiter.GetConnectionAsync();
+                            return waiter.GetConnectionAsync(this, request, cancellationToken);
                         }

                         // Note that we don't check for _disposed.  We may end up disposing the


Free temp array once done with it.

Free temp array once done with it.

--- src/Workspaces/Core/Portable/EmbeddedLanguages/RegularExpressions/RegexParser.cs
+++ src/Workspaces/Core/Portable/EmbeddedLanguages/RegularExpressions/RegexParser.cs
@@ -1380,7 +1380,7 @@
                 builder.Add(ParseSingleCharacterClassComponent(isFirst: false, afterRangeMinus: true));
             }

-            return new RegexSequenceNode(builder.ToImmutable());
+            return new RegexSequenceNode(builder.ToImmutableAndFree());
         }

         private RegexPrimaryExpressionNode ParseSingleCharacterClassComponent(bool isFirst, bool afterRangeMinus)


Added using block around a disposable type usage

Noticed this when reviewed an already-merged PR

--- test/dotnet-watch.FunctionalTests/FileWatcherTests.cs
+++ test/dotnet-watch.FunctionalTests/FileWatcherTests.cs
@@ -304,42 +304,44 @@

         private void AssertFileChangeRaisesEvent(string directory, IFileSystemWatcher watcher)
         {
-            var semaphoreSlim = new SemaphoreSlim(0);
-            var expectedPath = Path.Combine(directory, Path.GetRandomFileName());
-            EventHandler<string> handler = (object _, string f) =>
-            {
-                _output.WriteLine("File changed: " + f);
+            using (var semaphoreSlim = new SemaphoreSlim(0))
+            {
+                var expectedPath = Path.Combine(directory, Path.GetRandomFileName());
+                EventHandler<string> handler = (object _, string f) =>
+                {
+                    _output.WriteLine("File changed: " + f);
+                    try
+                    {
+                        if (string.Equals(f, expectedPath, StringComparison.OrdinalIgnoreCase))
+                        {
+                            semaphoreSlim.Release();
+                        }
+                    }
+                    catch (ObjectDisposedException)
+                    {
+                        // There's a known race condition here:
+                        // even though we tell the watcher to stop raising events and we unsubscribe the handler
+                        // there might be in-flight events that will still process. Since we dispose the reset
+                        // event, this code will fail if the handler executes after Dispose happens.
+                    }
+                };
+
+                File.AppendAllText(expectedPath, " ");
+
+                watcher.OnFileChange += handler;
                 try
                 {
-                    if (string.Equals(f, expectedPath, StringComparison.OrdinalIgnoreCase))
-                    {
-                        semaphoreSlim.Release();
-                    }
-                }
-                catch (ObjectDisposedException)
-                {
-                    // There's a known race condition here:
-                    // even though we tell the watcher to stop raising events and we unsubscribe the handler
-                    // there might be in-flight events that will still process. Since we dispose the reset
-                    // event, this code will fail if the handler executes after Dispose happens.
-                }
-            };
-
-            File.AppendAllText(expectedPath, " ");
-
-            watcher.OnFileChange += handler;
-            try
-            {
-                // On Unix the file write time is in 1s increments;
-                // if we don't wait, there's a chance that the polling
-                // watcher will not detect the change
-                Thread.Sleep(1000);
-                File.AppendAllText(expectedPath, " ");
-                Assert.True(semaphoreSlim.Wait(DefaultTimeout), "Expected a file change event for " + expectedPath);
-            }
-            finally
-            {
-                watcher.OnFileChange -= handler;
+                    // On Unix the file write time is in 1s increments;
+                    // if we don't wait, there's a chance that the polling
+                    // watcher will not detect the change
+                    Thread.Sleep(1000);
+                    File.AppendAllText(expectedPath, " ");
+                    Assert.True(semaphoreSlim.Wait(DefaultTimeout), "Expected a file change event for " + expectedPath);
+                }
+                finally
+                {
+                    watcher.OnFileChange -= handler;
+                }
             }
         }


[Makefile] Remove useless calls to Append.

--- Sharpmake.Generators/Generic/Makefile.cs
+++ Sharpmake.Generators/Generic/Makefile.cs
@@ -463,18 +463,18 @@
                 // ExtraWarnings
                 SelectOption(conf,
                     Options.Option(Options.Makefile.Compiler.ExtraWarnings.Enable, () => { cflags.Append("-Wextra "); }),
-                    Options.Option(Options.Makefile.Compiler.ExtraWarnings.Disable, () => { cflags.Append(""); })
+                    Options.Option(Options.Makefile.Compiler.ExtraWarnings.Disable, () => {  })
                     );

                 // GenerateDebugInformation
                 SelectOption(conf,
                     Options.Option(Options.Makefile.Compiler.GenerateDebugInformation.Enable, () => { cflags.Append("-g "); }),
-                    Options.Option(Options.Makefile.Compiler.GenerateDebugInformation.Disable, () => { cflags.Append(""); })
+                    Options.Option(Options.Makefile.Compiler.GenerateDebugInformation.Disable, () => {  })
                     );

                 // OptimizationLevel
                 SelectOption(conf,
-                    Options.Option(Options.Makefile.Compiler.OptimizationLevel.Disable, () => { cflags.Append(""); }),
+                    Options.Option(Options.Makefile.Compiler.OptimizationLevel.Disable, () => {  }),
                     Options.Option(Options.Makefile.Compiler.OptimizationLevel.Standard, () => { cflags.Append("-O1 "); }),
                     Options.Option(Options.Makefile.Compiler.OptimizationLevel.Full, () => { cflags.Append("-O2 "); }),
                     Options.Option(Options.Makefile.Compiler.OptimizationLevel.FullWithInlining, () => { cflags.Append("-O3 "); }),
@@ -483,7 +483,7 @@

                 // Warnings
                 SelectOption(conf,
-                    Options.Option(Options.Makefile.Compiler.Warnings.NormalWarnings, () => { cflags.Append(""); }),
+                    Options.Option(Options.Makefile.Compiler.Warnings.NormalWarnings, () => {  }),
                     Options.Option(Options.Makefile.Compiler.Warnings.MoreWarnings, () => { cflags.Append("-Wall "); }),
                     Options.Option(Options.Makefile.Compiler.Warnings.Disable, () => { cflags.Append("-w "); })
                     );
@@ -491,7 +491,7 @@
                 // WarningsAsErrors
                 SelectOption(conf,
                     Options.Option(Options.Makefile.Compiler.TreatWarningsAsErrors.Enable, () => { cflags.Append("-Werror "); }),
-                    Options.Option(Options.Makefile.Compiler.TreatWarningsAsErrors.Disable, () => { cflags.Append(""); })
+                    Options.Option(Options.Makefile.Compiler.TreatWarningsAsErrors.Disable, () => {  })
                     );

                 // AdditionalCompilerOptions


[Sln] Use ProjectFileName instead of ProjectFullFileName to sort, since that last one is a full path hence machine specific

--- Sharpmake.Generators/VisualStudio/Sln.cs
+++ Sharpmake.Generators/VisualStudio/Sln.cs
@@ -756,7 +756,7 @@
                     e.Configuration.Output == Project.Configuration.OutputType.DotNetConsoleApp ||
                     e.Configuration.Output == Project.Configuration.OutputType.DotNetWindowsApp ||
                     e.Configuration.Output == Project.Configuration.OutputType.Exe)
-                .GroupBy(e => e.Configuration.ProjectFullFileName)
+                .GroupBy(e => e.Configuration.ProjectFileName)
                 .OrderBy(filename => filename.Key, StringComparer.InvariantCultureIgnoreCase)
                 .ToList();


Bugfix: API seems to refuse to set a position higher than 5.

Inspecting with Fiddler, the product image is serializing correctly and sending a position higher than 5 (e.g. 6), but the update result returns position 5. Setting it lower than 5 updates it as expected.

--- ShopifySharp.Tests/ProductImage_Tests.cs
+++ ShopifySharp.Tests/ProductImage_Tests.cs
@@ -78,7 +78,8 @@
         public async Task Updates_ProductImages()
         {
             var created = await Fixture.Create();
-            int position = created.Position.Value + 1;
+            // API seems to refuse to set a position higher than 5.
+            int position = created.Position >= 5 ? 4 : created.Position.Value + 1;
             long id = created.Id.Value;

             created.Position = position;


Menu smaller btns

Menu smaller btns

--- Sibelius.Web/Views/Shared/_Layout.cshtml
+++ Sibelius.Web/Views/Shared/_Layout.cshtml
@@ -50,13 +50,13 @@

-                        ¿QUÉ ES ESTO?
+                        ¿QUÉ ES ESTO?

-
+

-
+


Done Partition api docs

Done Partition api docs

--- source/Cosmos.HAL2/BlockDevice/Partition.cs
+++ source/Cosmos.HAL2/BlockDevice/Partition.cs
@@ -2,11 +2,26 @@

 namespace Cosmos.HAL.BlockDevice
 {
+    /// <summary>
+    /// Partition class. Used to read and write blocks of data.
+    /// </summary>
 	public class Partition : BlockDevice
 	{
+        /// <summary>
+        /// Hosting device.
+        /// </summary>
 		private readonly BlockDevice mHost;
+        /// <summary>
+        /// Starting sector.
+        /// </summary>
 		private readonly UInt64 mStartingSector;

+        /// <summary>
+        /// Create new inctanse of the <see cref="Partition"/> class.
+        /// </summary>
+        /// <param name="aHost">A hosting device.</param>
+        /// <param name="aStartingSector">A starting sector.</param>
+        /// <param name="aSectorCount">A sector count.</param>
 		public Partition(BlockDevice aHost, UInt64 aStartingSector, UInt64 aSectorCount)
 		{
 			mHost = aHost;
@@ -15,6 +30,14 @@
 			mBlockSize = aHost.BlockSize;
 		}

+        /// <summary>
+        /// Read block from partition.
+        /// </summary>
+        /// <param name="aBlockNo">A block to read from.</param>
+        /// <param name="aBlockCount">A number of blocks in the partition.</param>
+        /// <param name="aData">A data that been read.</param>
+        /// <exception cref="OverflowException">Thrown when data lenght is greater then Int32.MaxValue.</exception>
+        /// <exception cref="Exception">Thrown when data size invalid.</exception>
 		public override void ReadBlock(UInt64 aBlockNo, UInt64 aBlockCount, ref byte[] aData)
 		{
             CheckDataSize(aData, aBlockCount);
@@ -23,6 +46,14 @@
 			mHost.ReadBlock(xHostBlockNo, aBlockCount, ref aData);
 		}

+        /// <summary>
+        /// Write block to partition.
+        /// </summary>
+        /// <param name="aBlockNo">A block number to write to.</param>
+        /// <param name="aBlockCount">A number of blocks in the partition.</param>
+        /// <param name="aData">A data to write.</param>
+        /// <exception cref="OverflowException">Thrown when data lenght is greater then Int32.MaxValue.</exception>
+        /// <exception cref="Exception">Thrown when data size invalid.</exception>
 		public override void WriteBlock(UInt64 aBlockNo, UInt64 aBlockCount,ref  byte[] aData)
 		{
             CheckDataSize(aData, aBlockCount);
@@ -31,6 +62,10 @@
 			mHost.WriteBlock(xHostBlockNo, aBlockCount, ref aData);
 		}

+        /// <summary>
+        /// To string.
+        /// </summary>
+        /// <returns>string value.</returns>
 	    public override string ToString()
 	    {
 	        return "Partition";


* remove dup

* remove dup

--- source/EasyBlock.Core.Tests/TestHostFIle.cs
+++ source/EasyBlock.Core.Tests/TestHostFIle.cs
@@ -150,18 +150,4 @@
         }
     }

-    public static class TestExtensionsForTextFileReader
-    {
-        public static void SetData(this ITextFileReader reader, IEnumerable<string> lines)
-        {
-            var queue = new Queue<string>(lines);
-            reader.ReadLine().Returns(ci =>
-            {
-                if (!queue.Any())
-                    return null;
-                return queue.Dequeue();
-            });
-        }
-
-    }
 }


Add region to IndicatorControl

Add region to IndicatorControl

--- SliderControlLibrary/IndicatorControl.cs
+++ SliderControlLibrary/IndicatorControl.cs
@@ -42,6 +42,19 @@
             {
                 e.Graphics.DrawPolygon(pen, polygon);
             }
+
+            for (var i = 2; i < polygon.Length; ++i)
+            {
+                polygon[i].Y += 1;
+            }
+            for (var i = 1; i < 4; ++i)
+            {
+                polygon[i].X += 1;
+            }
+
+            var path = new GraphicsPath();
+            path.AddPolygon(polygon);
+            Region = new Region(path);
         }
     }
 }


#268 - making DefaultBootstrapper.GetAssemblyFileNamesToScanForExtensions return an empty list

--- Source/FakeItEasy/DefaultBootstrapper.cs
+++ Source/FakeItEasy/DefaultBootstrapper.cs
@@ -1,8 +1,7 @@
 namespace FakeItEasy
 {
-    using System;
     using System.Collections.Generic;
-    using System.IO;
+    using System.Linq;

     /// <summary>
     /// The default bootstrapper, used to initialize FakeItEasy unless another
@@ -17,13 +16,13 @@
         /// <see cref="IDummyDefinition"/>s, <see cref="IArgumentValueFormatter"/>s, and
         /// <see cref="IFakeConfigurator"/>s.
         /// </summary>
-        /// <remark>This implementation returns the absolute paths of all the DLLs in the
-        /// <see cref="System.Environment.CurrentDirectory"/>.
-        /// </remark>
-        /// <returns>A list of absolute paths of to assemblies to scan for extension points.</returns>
+        /// <returns>
+        /// An empty list, but may be overridden to provide a list of absolute paths
+        /// to assemblies to scan for extension points.
+        /// </returns>
         public virtual IEnumerable<string> GetAssemblyFileNamesToScanForExtensions()
         {
-            return Directory.GetFiles(Environment.CurrentDirectory, "*.dll");
+            return Enumerable.Empty<string>();
         }
     }
 }


Points to the Nunit installed in Program Files x86 as that is where the latest version of Nunit installs to even on x64 machines

--- Source/MSBuild.Community.Tasks/NUnit3.cs
+++ Source/MSBuild.Community.Tasks/NUnit3.cs
@@ -440,6 +440,12 @@
             nunitPath = Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles);
             nunitPath = Path.Combine(nunitPath, DEFAULT_NUNIT_DIRECTORY);

+            if (Directory.Exists(nunitPath) == false)
+            {
+                nunitPath = Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86);
+                nunitPath = Path.Combine(nunitPath, DEFAULT_NUNIT_DIRECTORY);
+            }
+
             try
             {
                 string value = Registry.GetValue(InstallDirKey, "InstallDir", nunitPath) as string;


Replace chars in ToString output so they don't produce markup formatting (#207)

***NO_CI***


Disable the CC0020 code fix when it would cause a syntax error

--- src/CodeCracker/ConvertSimpleLambdaExpressionToMethodInvocationFixProvider.cs
+++ src/CodeCracker/ConvertSimpleLambdaExpressionToMethodInvocationFixProvider.cs
@@ -42,9 +42,34 @@
             root = root.ReplaceNode(lambda as ExpressionSyntax, methodName as ExpressionSyntax);
             var newDocument = context.Document.WithSyntaxRoot(root);

+            // verify that the conversion is correct
+            var newSemanticModel = await newDocument.GetSemanticModelAsync(context.CancellationToken).ConfigureAwait(false);
+            var newRoot = await newDocument.GetSyntaxRootAsync(context.CancellationToken).ConfigureAwait(false);
+            var identifierToken = newRoot.FindToken(diagnosticSpan.Start);
+            var newDiagnostics = newSemanticModel.Compilation.GetDiagnostics(context.CancellationToken);
+            var diagnosticErrors = newDiagnostics.WhereAsArray(i => i.Severity == DiagnosticSeverity.Error);
+            if (diagnosticErrors.Any(error => LocationOverlapsIdentifierName(identifierToken.Parent, error)))
+                return;
+
             context.RegisterFix(CodeAction.Create(
                 "Use method name instead of lambda expression when signatures match",
                 newDocument), diagnostic);
         }
+
+        private bool LocationOverlapsIdentifierName(SyntaxNode node, Diagnostic error)
+        {
+            var errorLocation = error.Location;
+            if (errorLocation == null)
+                return false;
+
+            var nodeLocation = node.GetLocation();
+            if (nodeLocation == null)
+                return false;
+
+            if (errorLocation.SourceTree != nodeLocation.SourceTree)
+                return false;
+
+            return nodeLocation.SourceSpan.OverlapsWith(errorLocation.SourceSpan);
+        }
     }
 }


fixed incorrect extension change

fixed incorrect extension change

--- src/CommitmentsV2/SFA.DAS.CommitmentsV2/Domain/Extensions/AlertsExtensions.cs
+++ src/CommitmentsV2/SFA.DAS.CommitmentsV2/Domain/Extensions/AlertsExtensions.cs
@@ -69,7 +69,7 @@

         private static bool HasCourseDataLockPendingChanges(Apprenticeship source)
         {
-            return source.IsProviderSearch && source.DataLockStatus.Any(x =>
+            return source.DataLockStatus.Any(x =>
                 x.WithCourseError() &&
                 x.TriageStatus == TriageStatus.Change &&
                 !x.IsResolved);


Added test to work thru bug

Added test to work thru bug

--- src/EditorFeatures/CSharpTest/CodeActions/ExtractMethod/ExtractMethodTests.cs
+++ src/EditorFeatures/CSharpTest/CodeActions/ExtractMethod/ExtractMethodTests.cs
@@ -115,6 +115,31 @@
         return b != true;
     }
 }");
+        }
+
+        [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsExtractMethod)]
+        public async Task TestSwitchExpression()
+        {
+            await TestInRegularAndScript1Async(
+@"class Program
+{
+    int Foo(int x) => x switch
+    {
+        1 => 1,
+        _ => [|1 + x|]
+    };
+}",
+@"class Program
+{
+    int Foo(int x) => x switch
+    {
+        1 => 1,
+        _ => NewMethod(x)
+    };
+
+    private static int NewMethod(x) => 1 + x;
+}",
+new TestParameters(options: Option(CSharpCodeStyleOptions.PreferExpressionBodiedMethods, CSharpCodeStyleOptions.WhenPossibleWithSilentEnforcement)));
         }

         [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsExtractMethod)]


Don't reset the synchronization context

Don't reset the synchronization context

--- src/EditorFeatures/Core/Shared/Utilities/ForegroundThreadAffinitizedObject.cs
+++ src/EditorFeatures/Core/Shared/Utilities/ForegroundThreadAffinitizedObject.cs
@@ -46,6 +46,9 @@
             }

             s_foregroundThread = Thread.CurrentThread;
+#if true
+            s_foregroundTaskScheduler = TaskScheduler.FromCurrentSynchronizationContext();
+#else
             var previousContext = SynchronizationContext.Current;
             try
             {
@@ -59,6 +62,7 @@
             {
                 SynchronizationContext.SetSynchronizationContext(previousContext);
             }
+#endif

             return new ForegroundThreadAffinitizedObject();
         }


[LibraryWatcher] Clear the queue when disposing

--- src/Extensions/Banshee.LibraryWatcher/Banshee.LibraryWatcher/SourceWatcher.cs
+++ src/Extensions/Banshee.LibraryWatcher/Banshee.LibraryWatcher/SourceWatcher.cs
@@ -107,6 +107,10 @@
                 watcher.Created -= OnChanged;
                 watcher.Deleted -= OnChanged;
                 watcher.Renamed -= OnChanged;
+
+                lock (queue) {
+                    queue.Clear ();
+                }

                 watcher.Dispose ();
                 disposed = true;


Follow up changes as pointed out in #32

Follow up changes as pointed out in #32

--- AngleSharp/Parser/Css/CssSelectorConstructor.cs
+++ AngleSharp/Parser/Css/CssSelectorConstructor.cs
@@ -243,10 +243,8 @@

 			state = State.AttributeOperator;

-			if (token.Type == CssTokenType.Ident)
+			if (token.Type == CssTokenType.Ident || token.Type == CssTokenType.String)
 				attrName = token.Data;
-            else if (token.Type == CssTokenType.String)
-                attrName = ((CssStringToken)token).Data;
             else
             {
                 state = State.Data;
@@ -293,12 +291,8 @@

 			state = State.AttributeEnd;

-			if (token.Type == CssTokenType.Ident)
+			if (token.Type == CssTokenType.Ident || token.Type == CssTokenType.String || token.Type == CssTokenType.Number)
 				attrValue = token.Data;
-			else if (token.Type == CssTokenType.String)
-				attrValue = ((CssStringToken)token).Data;
-            else if (token.Type == CssTokenType.Number)
-                attrValue = ((CssNumberToken)token).Data.ToString();
             else
             {
                 state = State.Data;
@@ -520,9 +514,7 @@
 				}
 				case pseudoClassFunctionContains:
 				{
-					if (token.Type == CssTokenType.String)
-						attrValue = ((CssStringToken)token).Data;
-					else if (token.Type == CssTokenType.Ident)
+					if (token.Type == CssTokenType.String || token.Type == CssTokenType.Ident)
 						attrValue = token.Data;

 					state = State.PseudoClassFunctionEnd;


Fixed #878, observer called too late

Fixed #878, observer called too late

--- src/MassTransit.AzureServiceBusTransport/Transport/ServiceBusSendTransport.cs
+++ src/MassTransit.AzureServiceBusTransport/Transport/ServiceBusSendTransport.cs
@@ -23,7 +23,6 @@
     using Contexts;
     using GreenPipes;
     using Logging;
-    using MassTransit.Pipeline;
     using MassTransit.Pipeline.Observables;
     using MassTransit.Scheduling;
     using Microsoft.ServiceBus.Messaging;
@@ -92,6 +91,8 @@
                 }
                 else
                 {
+                    await _observers.PreSend(context).ConfigureAwait(false);
+
                     using (var messageBodyStream = context.GetBodyStream())
                     {
                         using (var brokeredMessage = new BrokeredMessage(messageBodyStream))
@@ -147,8 +148,6 @@
                             }
                             else
                             {
-                                await _observers.PreSend(context).ConfigureAwait(false);
-
                                 await _client.Send(brokeredMessage).ConfigureAwait(false);

                                 context.LogSent();


Update AddSignalRCore to respect user registered services (#2434)

--- src/Microsoft.AspNetCore.SignalR.Core/SignalRDependencyInjectionExtensions.cs
+++ src/Microsoft.AspNetCore.SignalR.Core/SignalRDependencyInjectionExtensions.cs
@@ -3,6 +3,7 @@

 using Microsoft.AspNetCore.SignalR;
 using Microsoft.AspNetCore.SignalR.Internal;
+using Microsoft.Extensions.DependencyInjection.Extensions;

 namespace Microsoft.Extensions.DependencyInjection
 {
@@ -20,14 +21,14 @@
         public static ISignalRServerBuilder AddSignalRCore(this IServiceCollection services)
         {
             services.AddSingleton<SignalRCoreMarkerService>();
-            services.AddSingleton(typeof(HubLifetimeManager<>), typeof(DefaultHubLifetimeManager<>));
-            services.AddSingleton(typeof(IHubProtocolResolver), typeof(DefaultHubProtocolResolver));
-            services.AddSingleton(typeof(IHubContext<>), typeof(HubContext<>));
-            services.AddSingleton(typeof(IHubContext<,>), typeof(HubContext<,>));
-            services.AddSingleton(typeof(HubConnectionHandler<>), typeof(HubConnectionHandler<>));
-            services.AddSingleton(typeof(IUserIdProvider), typeof(DefaultUserIdProvider));
-            services.AddSingleton(typeof(HubDispatcher<>), typeof(DefaultHubDispatcher<>));
-            services.AddScoped(typeof(IHubActivator<>), typeof(DefaultHubActivator<>));
+            services.TryAddSingleton(typeof(HubLifetimeManager<>), typeof(DefaultHubLifetimeManager<>));
+            services.TryAddSingleton(typeof(IHubProtocolResolver), typeof(DefaultHubProtocolResolver));
+            services.TryAddSingleton(typeof(IHubContext<>), typeof(HubContext<>));
+            services.TryAddSingleton(typeof(IHubContext<,>), typeof(HubContext<,>));
+            services.TryAddSingleton(typeof(HubConnectionHandler<>), typeof(HubConnectionHandler<>));
+            services.TryAddSingleton(typeof(IUserIdProvider), typeof(DefaultUserIdProvider));
+            services.TryAddSingleton(typeof(HubDispatcher<>), typeof(DefaultHubDispatcher<>));
+            services.TryAddScoped(typeof(IHubActivator<>), typeof(DefaultHubActivator<>));
             services.AddAuthorization();

             var builder = new SignalRServerBuilder(services);


Fixed documentation for ${filesystem-normalize}

--- src/NLog/LayoutRenderers/Wrappers/FileSystemNormalizeLayoutRendererWrapper.cs
+++ src/NLog/LayoutRenderers/Wrappers/FileSystemNormalizeLayoutRendererWrapper.cs
@@ -56,7 +56,7 @@
         /// (illegal characters are replaced with '_').
         /// </summary>
         /// <docgen category='Advanced Options' order='10' />
-        [DefaultValue(false)]
+        [DefaultValue(true)]
         public bool FSNormalize { get; set; }

         /// <summary>


Fix namespace on the Media Cache Controller (#4455)

--- src/OrchardCore.Modules/OrchardCore.Media/Controllers/MediaCacheController.cs
+++ src/OrchardCore.Modules/OrchardCore.Media/Controllers/MediaCacheController.cs
@@ -9,7 +9,7 @@
 using OrchardCore.Media.ViewModels;
 using OrchardCore.Modules;

-namespace OrchardCore.Media.Azure.Controllers
+namespace OrchardCore.Media.Controllers
 {
     [Feature("OrchardCore.Media.Cache")]
     [Admin]


Finally, switching X and O by default.

Finally, switching X and O by default.

Fix #116

--- Assembly-CSharp/Global/Hono/HonoInputManager.cs
+++ Assembly-CSharp/Global/Hono/HonoInputManager.cs
@@ -39,8 +39,8 @@
 		};
 		this.defaultJoystickInputKeys = new String[]
 		{
+			"JoystickButton0",
 			"JoystickButton1",
-			"JoystickButton0",
 			"JoystickButton3",
 			"JoystickButton2",
 			"JoystickButton4",
@@ -52,8 +52,8 @@
 		};
 		this.defaultAndroidJoystickInputKeys = new String[]
 		{
+			"JoystickButton0",
 			"JoystickButton1",
-			"JoystickButton0",
 			"JoystickButton3",
 			"JoystickButton2",
 			"JoystickButton4",
@@ -78,8 +78,8 @@
 		};
 		this.defaultaaaaInputKeys = new String[]
 		{
+			"JoystickButton0",
 			"JoystickButton1",
-			"JoystickButton0",
 			"JoystickButton3",
 			"JoystickButton2",
 			"JoystickButton4",


Added gizmo to show the position where a new tile will appear before creating it

--- Assets/Code/HexTiles/Editor/HexTileMapEditor.cs
+++ Assets/Code/HexTiles/Editor/HexTileMapEditor.cs
@@ -104,11 +104,20 @@
             var controlId = GUIUtility.GetControlID(hexTileEditorHash, FocusType.Passive);
             switch (Event.current.GetTypeForControl(controlId))
             {
+                case EventType.MouseMove:
+                    var highlightedPosition = GetWorldPositionForMouse(Event.current.mousePosition);
+                    if (highlightedPosition != null)
+                    {
+                        hexMap.HighlightedTile = hexMap.QuantizeVector3ToHexCoords(highlightedPosition.GetValueOrDefault());
+                    }
+                    Event.current.Use();
+
+                    break;
                 case EventType.MouseDown:
                 case EventType.MouseDrag:
                     if (Event.current.button == 0)
                     {
-                        var position = GetWorldPositionForMouseClick(Event.current.mousePosition);
+                        var position = GetWorldPositionForMouse(Event.current.mousePosition);
                         hexMap.AddHexTile(hexMap.QuantizeVector3ToHexCoords(position.GetValueOrDefault()));
                         if (position != null)
                         {
@@ -176,7 +185,7 @@
         /// <summary>
         /// Return the point we would hit at the specified height for the specified mouse position.
         /// </summary>
-        private Nullable<Vector3> GetWorldPositionForMouseClick(Vector2 mousePosition)
+        private Nullable<Vector3> GetWorldPositionForMouse(Vector2 mousePosition)
         {
             var ray = HandleUtility.GUIPointToWorldRay(mousePosition);
             var plane = new Plane(Vector3.up, new Vector3(0, placementHeight, 0));
@@ -187,8 +196,6 @@
                 return ray.GetPoint(distance);
             }

-            // Could not get ray cast point
-            Debug.LogError("Could not find or place tile at the specified position");
             return null;
         }
     }


Added missing </summary> tag

Added missing </summary> tag

--- Assets/Code/HexTiles/Editor/HexTileMapEditor.cs
+++ Assets/Code/HexTiles/Editor/HexTileMapEditor.cs
@@ -691,6 +691,7 @@

         /// <summary>
         /// Highlights all the tiles under the current mouse position.
+        /// </summary>
         private void HighlightTilesUnderMousePosition()
         {
             var centerTile = TryFindTileForMousePosition(Event.current.mousePosition);


Correct variable list in flowchart window width

--- Assets/Fungus/Scripts/Editor/FlowchartWindow.cs
+++ Assets/Fungus/Scripts/Editor/FlowchartWindow.cs
@@ -516,7 +516,8 @@
                         {
                             if (variableListAdaptor.TargetFlowchart != null)
                             {
-                                variableListAdaptor.DrawVarList(0);
+                                //440 - space for scrollbar
+                                variableListAdaptor.DrawVarList(400);
                             }
                             else
                             {


Fixed a minor error in Saving

Fixed a minor error in Saving

--- Assets/UMAElements/Scripts/HumanoidStructure.cs
+++ Assets/UMAElements/Scripts/HumanoidStructure.cs
@@ -571,7 +571,6 @@
 			}
 			return false;
 		}
-

 		/// <summary>
 		/// Adds a wardrobe element to the humanoid-structure build, given it's element-name, and a single multiplier color.
@@ -1413,7 +1412,7 @@
 			{
 				if(n != 0) wardrobeparts += "^";
 				wardrobeparts += human.Wardrobe[n].element.Index;
-				if(human.Body[n].colors != null)
+				if(human.Wardrobe[n].colors != null)
 				{
 					if(human.Wardrobe[n].colors.Count == 1)
 						wardrobeparts += "," + human.Wardrobe[n].colors[0];


Fix large notification HTML overflowing CEF buffer and silently crashing

--- Browser/Handling/ResourceHandlerNotification.cs
+++ Browser/Handling/ResourceHandlerNotification.cs
@@ -1,4 +1,5 @@
-using System.Collections.Specialized;
+using System;
+using System.Collections.Specialized;
 using System.IO;
 using System.Text;
 using CefSharp;
@@ -39,9 +40,11 @@
             callback.Dispose();

             try{
-                int length = (int)dataIn.Length;
+                byte[] buffer = new byte[Math.Min(dataIn.Length, dataOut.Length)];
+                int length = buffer.Length;

-                dataIn.CopyTo(dataOut, length);
+                dataIn.Read(buffer, 0, length);
+                dataOut.Write(buffer, 0, length);
                 bytesRead = length;
                 return true;
             }catch{ // catch IOException, possibly NullReferenceException if dataIn is null


1302: remove duplicated code

1302: remove duplicated code

--- src/PixelFarm/LayoutFarm.YourBasicCustomWidgets/1_UIElement/3_AbstractRect.cs
+++ src/PixelFarm/LayoutFarm.YourBasicCustomWidgets/1_UIElement/3_AbstractRect.cs
@@ -178,12 +178,7 @@
                 this.CurrentPrimaryRenderElement.InvalidateGraphics();
             }
         }
-        public void InvalidateOuterGraphics()
-        {
-            //if we have primary render element
-            //invalidate 'bubble' rect start
-            CurrentPrimaryRenderElement?.InvalidateParentGraphics();
-        }
+
         public override void GetViewport(out int x, out int y)
         {
             //AbstractRect dose not have actual viewport
@@ -226,7 +221,7 @@
             //if you want viewport you must overide this
             SetViewport(x, y, this);
         }
-
+
         //------------------------------
         public virtual void PerformContentLayout()
         {


typo in js doc.

typo in js doc.

--- src/Qowaiv.CodeGenerator/Generators/Svo/Templates/SvoStruct_JavaScript.cshtml
+++ src/Qowaiv.CodeGenerator/Generators/Svo/Templates/SvoStruct_JavaScript.cshtml
@@ -55,7 +55,7 @@
 @(Model.ClassName).pattern = /ComplexPattern/;

 /**
- * Returns true if the specifed value is a valid @(Model.ClassLongName), otherwise false.
+ * Returns true if the specified value is a valid @(Model.ClassLongName), otherwise false.
  * @@param {object} v A value representing @(Model.ClassLongName).
  * @@param {string} c The culture to falidate for.
  */


Quarantine EnableCoreHostTraceLogging_PipeCaptureNativeLogs (#42914)

--- src/Servers/IIS/IIS/test/IIS.Shared.FunctionalTests/StdOutRedirectionTests.cs
+++ src/Servers/IIS/IIS/test/IIS.Shared.FunctionalTests/StdOutRedirectionTests.cs
@@ -106,6 +106,7 @@
     }

     [ConditionalTheory]
+    [QuarantinedTest("https://github.com/dotnet/aspnetcore/issues/42913")]
     [RequiresIIS(IISCapability.PoolEnvironmentVariables)]
     [SkipIfDebug]
     [InlineData("CheckLargeStdErrWrites")]


object-based card logic

object-based card logic

--- AI/AI/Program.cs
+++ AI/AI/Program.cs
@@ -74,7 +74,7 @@
   public struct Action {
     public Card Card;
     public ActionType ActionType;
-    public System.Enum ActionMode;
+    public System.ValueType ActionChoices;
   }

   public class Game {
@@ -82,38 +82,9 @@
   }

   public class CardData {
-    // When can this card add options for its owner?
-    public Dictionary<Card, PlaySpeed> PlaySpeeds = new Dictionary<Card, PlaySpeed> {
-    {Card.AridMesa, PlaySpeed.Land},
-    {Card.WoodedFoothills, PlaySpeed.Land},
-    {Card.RiftBolt, PlaySpeed.Sorcery},
-    {Card.SearingBlaze, PlaySpeed.Instant},
-    {Card.Skullcrack, PlaySpeed.Instant},
-    {Card.MonasterySwiftspear, PlaySpeed.Sorcery}
-  };
-
-    // Printed card types
-    public Dictionary<Card, List<CardType>> CardTypes = new Dictionary<Card, List<CardType>> {
-    {Card.AridMesa, new List<CardType> {CardType.Land}},
-    {Card.WoodedFoothills, new List<CardType> {CardType.Land}},
-    {Card.RiftBolt, new List<CardType> {CardType.Sorcery}},
-    {Card.SearingBlaze, new List<CardType> {CardType.Instant}},
-    {Card.Skullcrack, new List<CardType> {CardType.Instant}},
-    {Card.MonasterySwiftspear, new List<CardType> {CardType.Creature}}
-  };
-
-    // Printed mana costs, not including alternate costs
-    public Dictionary<Card, ManaValue> ManaCosts = new Dictionary<Card, ManaValue> {
-    {Card.RiftBolt, new ManaValue {RedValue = 1, GenericValue = 2}},
-    {Card.SearingBlaze, new ManaValue {RedValue = 2}},
-    {Card.Skullcrack, new ManaValue {RedValue = 1, GenericValue = 1}},
-    {Card.MonasterySwiftspear, new ManaValue {RedValue = 1}}
-  };
-
     public static void Main() {
       System.Console.WriteLine("Hello, World!");
-      var aridMesa = CardRegistry.Cards[Card.AridMesa] as AridMesaCard;
-      System.Console.WriteLine("Hello, " + aridMesa.Hello());
+      System.Console.ReadLine();
     }
   }

@@ -130,6 +101,12 @@

   public abstract class AbstractCard {
     public abstract Card GetCard();
+    public abstract ManaValue GetPrintedManaCost();
+    public abstract List<CardType> GetCardTypes();
+    public abstract PlaySpeed GetPlaySpeed();
+    public abstract void PopulateActions(GameState gameState, ICollection<Action> actions);
+    public abstract void PerformAction(GameState gameState, Action action);
+    public abstract void UndoAction(GameState gameState, Action action);
   }

   public class AridMesaCard : AbstractCard {
@@ -137,8 +114,28 @@
       return Card.AridMesa;
     }

-    public string Hello() {
-      return "AridMesa";
+    public override ManaValue GetPrintedManaCost() {
+      return new ManaValue();
+    }
+
+    public override List<CardType> GetCardTypes() {
+      return new List<CardType> { CardType.Land };
+    }
+
+    public override PlaySpeed GetPlaySpeed() {
+      return PlaySpeed.Land;
+    }
+
+    public override void PopulateActions(GameState gameState, ICollection<Action> actions) {
+      throw new System.NotImplementedException();
+    }
+
+    public override void PerformAction(GameState gameState, Action action) {
+      throw new System.NotImplementedException();
+    }
+
+    public override void UndoAction(GameState gameState, Action action) {
+      throw new System.NotImplementedException();
     }
   }

@@ -146,29 +143,149 @@
     public override Card GetCard() {
       return Card.WoodedFoothills;
     }
+
+    public override ManaValue GetPrintedManaCost() {
+      return new ManaValue();
+    }
+
+    public override List<CardType> GetCardTypes() {
+      return new List<CardType> { CardType.Land };
+    }
+
+    public override PlaySpeed GetPlaySpeed() {
+      return PlaySpeed.Land;
+    }
+
+    public override void PopulateActions(GameState gameState, ICollection<Action> actions) {
+      throw new System.NotImplementedException();
+    }
+
+    public override void PerformAction(GameState gameState, Action action) {
+      throw new System.NotImplementedException();
+    }
+
+    public override void UndoAction(GameState gameState, Action action) {
+      throw new System.NotImplementedException();
+    }
   }

   public class RiftBoltCard : AbstractCard {
     public override Card GetCard() {
       return Card.RiftBolt;
     }
+
+    public override ManaValue GetPrintedManaCost() {
+      return new ManaValue { RedValue = 1, GenericValue = 2 };
+    }
+
+    public override List<CardType> GetCardTypes() {
+      return new List<CardType> { CardType.Sorcery };
+    }
+
+    public override PlaySpeed GetPlaySpeed() {
+      return PlaySpeed.Sorcery;
+    }
+
+    public override void PopulateActions(GameState gameState, ICollection<Action> actions) {
+      throw new System.NotImplementedException();
+    }
+
+    public override void PerformAction(GameState gameState, Action action) {
+      throw new System.NotImplementedException();
+    }
+
+    public override void UndoAction(GameState gameState, Action action) {
+      throw new System.NotImplementedException();
+    }
   }

   public class SearingBlazeCard : AbstractCard {
     public override Card GetCard() {
       return Card.SearingBlaze;
     }
+
+    public override ManaValue GetPrintedManaCost() {
+      return new ManaValue { RedValue = 2 };
+    }
+
+    public override List<CardType> GetCardTypes() {
+      return new List<CardType> { CardType.Instant };
+    }
+
+    public override PlaySpeed GetPlaySpeed() {
+      return PlaySpeed.Instant;
+    }
+
+    public override void PopulateActions(GameState gameState, ICollection<Action> actions) {
+      throw new System.NotImplementedException();
+    }
+
+    public override void PerformAction(GameState gameState, Action action) {
+      throw new System.NotImplementedException();
+    }
+
+    public override void UndoAction(GameState gameState, Action action) {
+      throw new System.NotImplementedException();
+    }
   }

   public class SkullcrackCard : AbstractCard {
     public override Card GetCard() {
       return Card.Skullcrack;
     }
+
+    public override ManaValue GetPrintedManaCost() {
+      return new ManaValue { RedValue = 1, GenericValue = 1 };
+    }
+
+    public override List<CardType> GetCardTypes() {
+      return new List<CardType> { CardType.Instant };
+    }
+
+    public override PlaySpeed GetPlaySpeed() {
+      return PlaySpeed.Instant;
+    }
+
+    public override void PopulateActions(GameState gameState, ICollection<Action> actions) {
+      throw new System.NotImplementedException();
+    }
+
+    public override void PerformAction(GameState gameState, Action action) {
+      throw new System.NotImplementedException();
+    }
+
+    public override void UndoAction(GameState gameState, Action action) {
+      throw new System.NotImplementedException();
+    }
   }

   public class MonasterySwiftspearCard : AbstractCard {
     public override Card GetCard() {
       return Card.MonasterySwiftspear;
     }
+
+    public override ManaValue GetPrintedManaCost() {
+      return new ManaValue { RedValue = 1 };
+    }
+
+    public override List<CardType> GetCardTypes() {
+      return new List<CardType> { CardType.Creature };
+    }
+
+    public override PlaySpeed GetPlaySpeed() {
+      return PlaySpeed.Sorcery;
+    }
+
+    public override void PopulateActions(GameState gameState, ICollection<Action> actions) {
+      throw new System.NotImplementedException();
+    }
+
+    public override void PerformAction(GameState gameState, Action action) {
+      throw new System.NotImplementedException();
+    }
+
+    public override void UndoAction(GameState gameState, Action action) {
+      throw new System.NotImplementedException();
+    }
   }
 }


David/Stephen - Filtering out featured groups that are archived for the homepage

--- src/StockportContentApi/ContentfulFactories/GroupHomepageContentfulFactory.cs
+++ src/StockportContentApi/ContentfulFactories/GroupHomepageContentfulFactory.cs
@@ -34,9 +34,9 @@
             var groupSubCategory = _groupSubCategoryListFactory.ToModel(entry.FeaturedGroupsSubCategory);

             var featuredGroup = groups.Where(group => _dateComparer.DateNowIsNotBetweenHiddenRange(
-                group.DateHiddenFrom, group.DateHiddenTo));
+                group.DateHiddenFrom, group.DateHiddenTo)).ToList();

-            return new GroupHomepage(entry.Title, entry.Slug, backgroundImage, entry.FeaturedGroupsHeading, groups, groupCategory, groupSubCategory);
+            return new GroupHomepage(entry.Title, entry.Slug, backgroundImage, entry.FeaturedGroupsHeading, featuredGroup, groupCategory, groupSubCategory);
         }
     }
 }


Update IconCodecTests.cs (#40076)

Update IconCodecTests.cs (#40076)

```
Error message
System.ArgumentException : Parameter is not valid.

Stack trace
   at System.Drawing.Bitmap..ctor(String filename)
   at MonoTests.System.Drawing.Imaging.IconCodecTest.Bitmap16Features_Palette_Entries_Windows() in /_/src/System.Drawing.Common/tests/mono/System.Drawing.Imaging/IconCodecTests.cs:line 15
```

--- src/System.Drawing.Common/tests/mono/System.Drawing.Imaging/IconCodecTests.cs
+++ src/System.Drawing.Common/tests/mono/System.Drawing.Imaging/IconCodecTests.cs
@@ -148,6 +148,7 @@

         [PlatformSpecific(TestPlatforms.Windows)]
         [ConditionalFact(Helpers.IsDrawingSupported)]
+        [SkipOnTargetFramework(TargetFrameworkMonikers.NetFramework, "Flaky - ArgumentException")]
         public void Bitmap16Features_Palette_Entries_Windows()
         {
             string sInFile = Helpers.GetTestBitmapPath("48x48_multiple_entries_4bit.ico");


Add AzureDevOps as repository provider

Add AzureDevOps as repository provider

--- source/Nuke.Common/Execution/Telemetry.Properties.cs
+++ source/Nuke.Common/Execution/Telemetry.Properties.cs
@@ -51,7 +51,8 @@
                     (() => repository.Endpoint.ContainsOrdinalIgnoreCase("github.com"), "GitHub"),
                     (() => repository.Endpoint.ContainsOrdinalIgnoreCase("gitlab.com"), "GitLab"),
                     (() => repository.Endpoint.ContainsOrdinalIgnoreCase("bitbucket.org"), "Bitbucket"),
-                    (() => repository.Endpoint.ContainsOrdinalIgnoreCase("jetbrains.space"), "JetBrains")
+                    (() => repository.Endpoint.ContainsOrdinalIgnoreCase("jetbrains.space"), "JetBrains"),
+                    (() => repository.Endpoint.ContainsOrdinalIgnoreCase("visualstudio.com"), "Azure")
                 };

             var branches =


help description improvement

help description improvement

--- ReoGrid/Formula/Evaluator.cs
+++ ReoGrid/Formula/Evaluator.cs
@@ -1270,7 +1270,7 @@
 		CircularReference,

 		/// <summary>
-		/// A number value was required in formula calculation, but no valid number found. (Similar to "#VALUE!" in Excel)
+		/// A specified type was required during formula calculation, but no valid type found. (Similar to "#VALUE!" in Excel)
 		/// </summary>
 		InvalidValue,


converted suites collection in a list, updated location to latest cdn

--- ReportUnit/Templates/File.cs
+++ ReportUnit/Templates/File.cs
@@ -34,7 +34,8 @@
                     <title>ReportUnit TestRunner Report</title>
                     <link href='https://cdnjs.cloudflare.com/ajax/libs/materialize/0.97.2/css/materialize.min.css' rel='stylesheet' type='text/css'>
                     <link href='https://fonts.googleapis.com/css?family=Open+Sans:400,600' rel='stylesheet' type='text/css'>
-                    <link href='http://cdn.rawgit.com/reportunit/reportunit/master/resources/reportunit.css' rel='stylesheet' type='text/css'>
+                    <link href='http://cdn.rawgit.com/reportunit/reportunit/33bb5105b409d72169373ddca2b58f2ae20c36cd/cdn/reportunit.css' type='text/css' rel='stylesheet' />
+

@@ -47,17 +48,17 @@

                             @Model.FileName
-

-

+

+

-

+

-

+

                                     v1.50.0
-

-

+

+

@@ -148,66 +149,68 @@

-

-                                            @for (var ix = 0; ix < Model.TestSuiteList.Count; ix++)
-                                            {
-

-

-
@Model.TestSuiteList[ix].Name

-
@Model.TestSuiteList[ix].Status.ToString()

-

-

-		                                                @Model.TestSuiteList[ix].StartTime
-		                                                @if (!String.IsNullOrEmpty(@Model.TestSuiteList[ix].EndTime))
-		                                                {
-			                                                @Model.TestSuiteList[ix].EndTime
-		                                                }
-

-			                                                @if (!String.IsNullOrEmpty(@Model.TestSuiteList[ix].Description))
-			                                                {
-
@Model.TestSuiteList[ix].Description

-			                                                }
-			                                                @if (!String.IsNullOrEmpty(@Model.TestSuiteList[ix].StatusMessage))
-			                                                {
-
@Model.TestSuiteList[ix].StatusMessage

-			                                                }
-

-

-

-

-					                                                TestName
-					                                                Status
-

-

-

-                                                                @foreach (var test in Model.TestSuiteList[ix].TestList)
-                                                                {
-

-                                                                        @test.Name
-
-                                                                            @test.Status.ToString()
-

-                                                                                @foreach (var cat in test.CategoryList)
+

+

+                                                @for (var ix = 0; ix < Model.TestSuiteList.Count; ix++)
+                                                {
+

+

+
@Model.TestSuiteList[ix].Name

+
@Model.TestSuiteList[ix].Status.ToString()

+

+

+		                                                    @Model.TestSuiteList[ix].StartTime
+		                                                    @if (!String.IsNullOrEmpty(@Model.TestSuiteList[ix].EndTime))
+		                                                    {
+			                                                    @Model.TestSuiteList[ix].EndTime
+		                                                    }
+

+			                                                    @if (!String.IsNullOrEmpty(@Model.TestSuiteList[ix].Description))
+			                                                    {
+
@Model.TestSuiteList[ix].Description

+			                                                    }
+			                                                    @if (!String.IsNullOrEmpty(@Model.TestSuiteList[ix].StatusMessage))
+			                                                    {
+
@Model.TestSuiteList[ix].StatusMessage

+			                                                    }
+

+

+

+

+					                                                    TestName
+					                                                    Status
+

+

+

+                                                                    @foreach (var test in Model.TestSuiteList[ix].TestList)
+                                                                    {
+

+                                                                            @test.Name
+
+                                                                                @test.Status.ToString()
+

+                                                                                @foreach (var cat in test.CategoryList)
+                                                                                {
+                                                                                @cat
+                                                                                }
+

+                                                                                @if (!String.IsNullOrEmpty(@test.Description))
                                                                                {
-                                                                                @cat
+
@test.Description

                                                                                }
-

-                                                                            @if (!String.IsNullOrEmpty(@test.Description))
-                                                                            {
-
@test.Description

-                                                                            }
-                                                                            @if (!String.IsNullOrEmpty(@test.StatusMessage)) {
-
@test.StatusMessage

-                                                                            }
-
-
-

-                                                                }
-

-

-

-

-                                            }
+                                                                                @if (!String.IsNullOrEmpty(@test.StatusMessage)) {
+
@test.StatusMessage

+                                                                                }
+
+
+

+                                                                    }
+

+

+

+

+                                                }
+

@@ -267,7 +270,7 @@

-
+

             ".Replace("\r\n", "").Replace("\t", "").Replace("    ", "");
         }


Modifying Validate class to remove string parameter

--- Rhino.Mocks/Impl/Validate.cs
+++ Rhino.Mocks/Impl/Validate.cs
@@ -27,8 +27,10 @@
 #endregion

-using System;
-using Rhino.Mocks.Interfaces;
+using System;
+using System.Linq.Expressions;
+using Rhino.Mocks.Interfaces;
+using System.Reflection;
 using System.Collections;

 namespace Rhino.Mocks.Impl
@@ -51,7 +53,28 @@
 		{
 			if (obj == null)
 				throw new ArgumentNullException(name);
-		}
+		}
+
+        /// <summary>
+        /// Validates that the passed argument is not null
+        /// </summary>
+        /// <typeparam name="T"></typeparam>
+        /// <param name="reference">The reference.</param>
+        public static void IsNotNull<T>(Expression<Func<T>> reference)
+        {
+            if (reference.Body.GetConstantValue<T>() == null) throw new ArgumentNullException(GetParameterName(reference));
+        }
+
+        /// <summary>
+        /// Validates that the passed argument is not null
+        /// </summary>
+        /// <typeparam name="T"></typeparam>
+        /// <param name="reference">The reference.</param>
+        /// <param name="message">The message.</param>
+        public static void IsNotNull<T>(Expression<Func<T>> reference, string message)
+        {
+            if (reference.Body.GetConstantValue<T>() == null) throw new ArgumentNullException(GetParameterName(reference), message);
+        }

 		/// <summary>
 		/// Validate that the arguments are equal.
@@ -132,7 +155,32 @@
             //this may not be what the user is expecting, but it is needed, because
             //otherwise we get into endless loop.
             return MockedObjectsEquality.Instance.Equals(expected,actual);
+        }
+
+        private static string GetParameterName(Expression reference)
+        {
+            var lambda = reference as LambdaExpression;
+            var member = lambda.Body as MemberExpression;
+
+            return member.Member.Name;
+        }
+
+        private static T GetConstantValue<T>(this Expression expression)
+        {
+            if (expression.NodeType == ExpressionType.Constant)
+                return (T)(((ConstantExpression)expression).Value);
+
+            if (expression.NodeType == ExpressionType.MemberAccess)
+            {
+                var memberExpr = (MemberExpression)expression;
+                var memberInfo = memberExpr.Member as FieldInfo;
+                if (memberInfo != null)
+                    return (T)memberInfo.GetValue(memberExpr.Expression.GetConstantValue<object>());
+            }
+
+            return Expression.Lambda<Func<T>>(Expression.Convert(expression, typeof(T)), new ParameterExpression[0]).Compile()();
         }
+
 		#endregion
 	}
 }


ignore get champions free to play as they are returning 12 champs instead of 10

--- RiotSharpTest/RiotApiTest.cs
+++ RiotSharpTest/RiotApiTest.cs
@@ -160,6 +160,7 @@
             Assert.IsTrue(champions.Result.Count() > 0);
         }

+        [Ignore]
         [TestMethod]
         [TestCategory("RiotApi")]
         public void GetChampions_FreeToPlay_Test()
@@ -170,6 +171,7 @@
             Assert.IsTrue(champions.Count() == 10);
         }

+        [Ignore]
         [TestMethod]
         [TestCategory("RiotApi"), TestCategory("Async")]
         public void GetChampionsAsync_FreeToPlay_Test()


Improved date parsing.

Improved date parsing.

--- Rusty/Core/Common/Formats.cs
+++ Rusty/Core/Common/Formats.cs
@@ -364,7 +364,6 @@
             str.Append(time.Minute.ToString().PadLeft(len, pad));
             str.Append(time.Second.ToString().PadLeft(len, pad));
             return int.Parse(str.ToString());
-
         }

         static DateTime ToDateTime(string time)
@@ -372,15 +371,15 @@
             if (time.Length > 7)
                 return DateTime.Now;

-            int[] t = new int[7];
+            int[] t = { DateTime.Now.Year / 100, DateTime.Now.Year % 100, 1, 1, 0, 0, 0, 0 };

             for (int i = 0, k = 0; i < t.Length; i++, k += 2)
             {
-                if (!int.TryParse(time.Substring(k, 2), out t[i]))
-                    throw new ArgumentOutOfRangeException();
-            }
-
-            return new DateTime(t[0] * 1000 + t[1], t[2], t[3], t[4], t[5], t[6]);
+                if (k + 1 >= time.Length || !int.TryParse(time.Substring(k, 2), out t[i]))
+                    break;
+            }
+
+            return new DateTime(t[0] * 100 + t[1], t[2], t[3], t[4], t[5], t[6]);
         }

         static RegistryKey ToRegRootKey(string name)


Made link to Departamento de Hacienda open in new tab. (Issue #35)

--- debesalgo/Views/Home/Index.cshtml
+++ debesalgo/Views/Home/Index.cshtml
@@ -5,7 +5,7 @@

-
Lista no oficial de comercios embargados por el Departamento de Hacienda en Puerto Rico.

+
Lista no oficial de comercios embargados por el Departamento de Hacienda en Puerto Rico.


Check correct vessel situation for unloaded vessels

--- Source/Parameters/DMOrbitalParameters.cs
+++ Source/Parameters/DMOrbitalParameters.cs
@@ -130,7 +130,7 @@

 				if (type == 0)
 				{
-					if (v.orbit.eccentricity > orbitalParameter && v.situation == Vessel.Situations.ORBITING)
+					if (v.orbit.eccentricity > orbitalParameter && (v.loaded ? v.situation : v.protoVessel.situation) == Vessel.Situations.ORBITING)
 					{
 						this.SetComplete();
 						return;
@@ -138,14 +138,14 @@
 				}
 				else if (type == 1)
 				{
-					if (Math.Abs(v.orbit.inclination) > orbitalParameter && Math.Abs(v.orbit.inclination) < (180 - orbitalParameter) && v.situation == Vessel.Situations.ORBITING)
+					if (Math.Abs(v.orbit.inclination) > orbitalParameter && Math.Abs(v.orbit.inclination) < (180 - orbitalParameter) && (v.loaded ? v.situation : v.protoVessel.situation) == Vessel.Situations.ORBITING)
 					{
 						this.SetComplete();
 						return;
 					}
 				}
 			}
-
+
 			this.SetIncomplete();
 		}


Moar logging

Moar logging

--- tests/StackExchange.Metrics.Tests/StatsdMetricHandlerTests.cs
+++ tests/StackExchange.Metrics.Tests/StatsdMetricHandlerTests.cs
@@ -32,7 +32,7 @@
         public async Task UdpUri_Counter_ReceivesValidStatsd(double value)
         {
             // delay because UDP gets all weird otherwise
-            await Task.Delay(500);
+            await Task.Delay(200);

             var port = (ushort)_rng.Next(1024, 65535);
             var handler = new StatsdMetricHandler("127.0.0.1", port);
@@ -40,7 +40,7 @@
             {
                 var utcNow = DateTime.UtcNow;
                 var reading = new MetricReading("test.metrics", MetricType.Counter, string.Empty, value, new Dictionary<string, string> { ["host"] = "test!" }, utcNow);
-                var listenerTask = ReceiveStatsdOverUdpAsync(port, cancellationTokenSource.Token);
+                var listenerTask = ReceiveStatsdOverUdpAsync(port, cancellationTokenSource.Token, _output);

                 // expected format: {metric}:{value}|{unit}|#{tag},{tag}
                 // so for this counter: "test.metrics:1|c|#host:test!
@@ -55,8 +55,8 @@
                 var actualBytes = await listenerTask;
                 var expectedBytes = ToStatsd(reading);

-                _output.WriteLine($"{string.Join(" ", actualBytes.Select(x => $"{x:x2}"))}");
-                _output.WriteLine($"{string.Join(" ", expectedBytes.Select(x => $"{x:x2}"))}");
+                _output.WriteLine($"Actual:\t\t{string.Join(" ", actualBytes.Select(x => $"{x:x2}"))}");
+                _output.WriteLine($"Expected:\t{string.Join(" ", expectedBytes.Select(x => $"{x:x2}"))}");

                 Assert.Equal(expectedBytes, actualBytes);
             }
@@ -79,7 +79,7 @@
             );
         }

-        public static async Task<byte[]> ReceiveStatsdOverUdpAsync(ushort port, CancellationToken cancellationToken)
+        public static async Task<byte[]> ReceiveStatsdOverUdpAsync(ushort port, CancellationToken cancellationToken, ITestOutputHelper output)
         {
             var bytesReceived = new List<byte>();
             await Task.Run(
@@ -88,17 +88,21 @@
                     var localEndpoint = new IPEndPoint(IPAddress.Loopback, port);
                     using (var udpClient = new UdpClient(localEndpoint))
                     {
-                        udpClient.Client.ReceiveTimeout = 25;
+                        udpClient.Client.ReceiveTimeout = 200;

-                        var retries = 0;
-                        while (!cancellationToken.IsCancellationRequested || ++retries < 3)
+                        while (!cancellationToken.IsCancellationRequested)
                         {
                             var remoteEndpoint = new IPEndPoint(IPAddress.Loopback, 0);
                             try
                             {
+                                output.WriteLine($"Listening on {localEndpoint}");
                                 bytesReceived.AddRange(udpClient.Receive(ref remoteEndpoint));
+                                output.WriteLine($"Received {bytesReceived.Count} bytes from {remoteEndpoint}");
                             }
-                            catch { }
+                            catch (Exception ex)
+                            {
+                                output.WriteLine(ex.ToString());
+                            }
                         }
                     }
                 });


Update ExchangeClientBase.cs

Update ExchangeClientBase.cs

Bug in POST will result in failure.

https://docs.gdax.com/#requests

--- CoinbaseExchange.NET/Core/ExchangeClientBase.cs
+++ CoinbaseExchange.NET/Core/ExchangeClientBase.cs
@@ -57,7 +57,7 @@
                         response = await httpClient.GetAsync(absoluteUri);
                         break;
                     case "POST":
-                        var requestBody = new StringContent(body);
+                        var requestBody = new StringContent(body, Encoding.UTF8, "application/json");
                         response = await httpClient.PostAsync(absoluteUri, requestBody);
                         break;
                     default:


Showing Environmental Pressure

Showing Environmental Pressure

--- Source/PetriPlanet/Gui/ExperimentForm.cs
+++ Source/PetriPlanet/Gui/ExperimentForm.cs
@@ -16,6 +16,7 @@
     private FlowLayoutPanel verticalLayout;
     private TrackBar trackBar;
     private Label clockLabel;
+    private Label environmentalPressureLabel;
     private Label populationLabel;
     private Label generationsLabel;
     private WorldView worldView;
@@ -52,6 +53,15 @@
         AutoSize = true,
       };
       this.verticalLayout.Controls.Add(headerLayout);
+
+      this.environmentalPressureLabel = new Label {
+        Text = string.Format("Environmental Pressure: {0}", this.experiment.EnvironmentalPressure),
+        ForeColor = Color.LightGray,
+        AutoSize = true,
+        // Hackish
+        Width = 200,
+      };
+      this.verticalLayout.Controls.Add(this.environmentalPressureLabel);

       this.populationLabel = new Label {
         Text = string.Format("Population: {0}", this.experiment.Population),
@@ -113,9 +123,10 @@
     private void OnSimulationTick(object sender, EventArgs eventArgs)
     {
       this.experiment.Tick();
-      this.clockLabel.Text = this.experiment.CurrentTime.ToString(westernFormatString);
+      this.environmentalPressureLabel.Text = string.Format("Environmental Pressure: {0}", this.experiment.EnvironmentalPressure);
       this.populationLabel.Text = string.Format("Population: {0}", this.experiment.Population);
       this.generationsLabel.Text = string.Format("Generations: {0}", this.experiment.GetGenerations());
+      this.clockLabel.Text = this.experiment.CurrentTime.ToString(westernFormatString);

       var trackBarValue = this.trackBar.Value;
       this.simulationTimer.Interval = trackBarValue == maxSpeed ? 1 : 500 / trackBarValue;


add unit test for Temporary Storage preserving SourceText Encoding

--- src/Workspaces/CoreTest/WorkspaceServiceTests/TemporaryStorageServiceTests.cs
+++ src/Workspaces/CoreTest/WorkspaceServiceTests/TemporaryStorageServiceTests.cs
@@ -4,6 +4,7 @@
 using System.Collections.Generic;
 using System.IO;
 using System.Linq;
+using System.Text;
 using System.Threading;
 using System.Threading.Tasks;
 using Microsoft.CodeAnalysis.Host;
@@ -323,5 +324,24 @@
                 }
             }
         }
+
+        [Fact(Skip = "https://github.com/dotnet/roslyn/issues/353"), Trait(Traits.Feature, Traits.Features.Workspace)]
+        public void TestTemporaryStorageTextEncoding()
+        {
+            var textFactory = new TextFactoryService();
+            var service = new TemporaryStorageServiceFactory.TemporaryStorageService(textFactory);
+
+            // test normal string
+            var text = SourceText.From(new string(' ', 4096) + "public class A {}", Encoding.ASCII);
+            TestTemporaryStorage(service, text);
+
+            // test empty string
+            text = SourceText.From(string.Empty);
+            TestTemporaryStorage(service, text);
+
+            // test large string
+            text = SourceText.From(new string(' ', 1024 * 1024) + "public class A {}");
+            TestTemporaryStorage(service, text);
+        }
     }
 }


bug fix: emoji-cheat-sheet.com.

bug fix: emoji-cheat-sheet.com.

Signed-off-by: Jerin Lee <af74fa2ce35b69390cf05d133cd2762ecd43713d@qq.com>

--- Consoles/ConsoleApp/Projects/EmojiCheatSheet.cs
+++ Consoles/ConsoleApp/Projects/EmojiCheatSheet.cs
@@ -101,7 +101,7 @@
           images.Add( image );

         var spanName = div.SelectSingleNode( "./span[@class='name']" );
-        string names = spanName == null ? null : spanName.Attributes["data-alternative-name"].Value;
+        string names = spanName != null && spanName.Attributes["data-alternative-name"] != null ? spanName.Attributes["data-alternative-name"].Value : null;

         item.Add( "short-name", shortName );
         item.Add( "alternative-names", names );


Cleanup

Cleanup

--- Content.Client/Construction/ConstructionMenu.cs
+++ Content.Client/Construction/ConstructionMenu.cs
@@ -261,15 +261,8 @@

         private void OnEraseToggled(BaseButton.ButtonToggledEventArgs args)
         {
-            if (args.Pressed)
-            {
-                Placement.Clear();
-                Placement.ToggleEraserHijacked(new ConstructionPlacementHijack(null, Owner));
-            }
-            else
-            {
-                Placement.ToggleEraserHijacked(new ConstructionPlacementHijack(null, Owner));
-            }
+            if (args.Pressed) Placement.Clear();
+            Placement.ToggleEraserHijacked(new ConstructionPlacementHijack(null, Owner));
             EraseButton.Pressed = args.Pressed;
         }


Updated to latest version of validator and reenabled

Updated to latest version of validator and reenabled

--- publish.cake
+++ publish.cake
@@ -4,7 +4,7 @@
 #addin "nuget:?package=Cake.Xamarin&version=3.0.0"
 #addin "nuget:?package=Cake.ExtendedNuGet&version=1.0.0.27"
 #addin "nuget:?package=NuGet.Core&version=2.14.0"
-#addin "nuget:?package=Xamarin.Nuget.Validator&version=1.0.0"
+#addin "nuget:?package=Xamarin.Nuget.Validator&version=1.1.0"

 var DEFAULT_SIGNTOOL_PATH = IsRunningOnWindows ()
 	? "C:\\Program Files (x86)\\Windows Kits\\10\\bin\\x64\\signtool.exe"
@@ -136,7 +136,7 @@
 Task ("VerifyNuGets")
 	.IsDependentOn ("VerifyAuthenticode")
 	.IsDependentOn ("VerifyNuGetSigning");
-//	.IsDependentOn ("VerifyNugetMetaData");
+	.IsDependentOn ("VerifyNugetMetaData");

 Task ("VerifyNuGetSigning")
 	.IsDependentOn ("DownloadArtifacts")


[ci] Fix addin versions to < cake 0.22 compatible

--- publish.cake
+++ publish.cake
@@ -1,6 +1,6 @@
 #tool "XamarinComponent"
-#addin "nuget:?package=Cake.Json"
-#addin "nuget:?package=Cake.Xamarin"
+#addin "nuget:?package=Cake.Json&version=1.0.2.13"
+#addin "nuget:?package=Cake.Xamarin&version=1.3.0.15"
 #addin "nuget:?package=Cake.ExtendedNuGet&version=1.0.0.24"
 #addin "nuget:?package=NuGet.Core&version=2.14.0"

@@ -98,4 +98,4 @@
 	UploadComponents (settings, globPatterns);
 });

-RunTarget (TARGET);+RunTarget (TARGET);


refactored the BestFriend API action

refactored the BestFriend API action

--- Ada/AdaWebApp/Models/DAL/Repositories/VisitRepository.cs
+++ Ada/AdaWebApp/Models/DAL/Repositories/VisitRepository.cs
@@ -51,74 +51,43 @@
             DateTime date2 = DateTime.Today;
             DateTime date1 = date2.AddDays(-2);
             List<Visit> bestFriends = new List<Visit>();
-            int maxPasses;

             //Best MALE friend
-            if (Table.Include(v => v.Person).Where(v => DbFunctions.TruncateTime(v.Date) >= DbFunctions.TruncateTime(date1)
-            && DbFunctions.TruncateTime(v.Date) <= DbFunctions.TruncateTime(date2)
-            && v.Person.FirstName != null
-            && v.Person.Gender == GenderValues.Male).Count() == 0)
-            {
-                bestFriends.Add(null);
-            }
-            else
-            {
-                maxPasses = Table.Include(v => v.Person).Where(v => DbFunctions.TruncateTime(v.Date) >= DbFunctions.TruncateTime(date1)
-            && DbFunctions.TruncateTime(v.Date) <= DbFunctions.TruncateTime(date2)
-            && v.Person.FirstName != null
-            && v.Person.Gender == GenderValues.Male).Max(v => v.NbPasses);
-                bestFriends.Add(
-                Table.Include(v => v.Person).Where(v => DbFunctions.TruncateTime(v.Date) >= DbFunctions.TruncateTime(date1)
-                && DbFunctions.TruncateTime(v.Date) <= DbFunctions.TruncateTime(date2)
-                && v.Person.FirstName != null
-                && v.Person.Gender == GenderValues.Male).First(v => v.NbPasses == maxPasses)
-                );
-            }
-            //Best FEMALE friend
-            if (Table.Include(v => v.Person).Where(v => DbFunctions.TruncateTime(v.Date) >= DbFunctions.TruncateTime(date1)
-            && DbFunctions.TruncateTime(v.Date) <= DbFunctions.TruncateTime(date2)
-            && v.Person.FirstName != null
-            && v.Person.Gender == GenderValues.Female).Count() == 0)
-            {
-                bestFriends.Add(null);
-            }
-            else
-            {
-                maxPasses = Table.Include(v => v.Person).Where(v => DbFunctions.TruncateTime(v.Date) >= DbFunctions.TruncateTime(date1)
-            && DbFunctions.TruncateTime(v.Date) <= DbFunctions.TruncateTime(date2)
-            && v.Person.FirstName != null
-            && v.Person.Gender == GenderValues.Female).Max(v => v.NbPasses);
-                bestFriends.Add(
-                Table.Include(v => v.Person).Where(v => DbFunctions.TruncateTime(v.Date) >= DbFunctions.TruncateTime(date1)
-                && DbFunctions.TruncateTime(v.Date) <= DbFunctions.TruncateTime(date2)
-                && v.Person.FirstName != null
-                && v.Person.Gender == GenderValues.Female).First(v => v.NbPasses == maxPasses)
-                );
-            }
-            //Best beard friend
-            if (Table.Include(v => v.Person).Where(v => DbFunctions.TruncateTime(v.Date) >= DbFunctions.TruncateTime(date1)
-            && DbFunctions.TruncateTime(v.Date) <= DbFunctions.TruncateTime(date2)
-            && v.Person.FirstName != null
-            && v.Person.Gender == GenderValues.Male
-            && v.ProfilePictures.OrderByDescending(p => p.Id).FirstOrDefault().Beard >= 0.5).Count() == 0)
-            {
-                bestFriends.Add(null);
-            }
-            else
-            {
-                maxPasses = Table.Include(v => v.Person).Where(v => DbFunctions.TruncateTime(v.Date) >= DbFunctions.TruncateTime(date1)
-            && DbFunctions.TruncateTime(v.Date) <= DbFunctions.TruncateTime(date2)
-            && v.Person.FirstName != null
-            && v.Person.Gender == GenderValues.Male
-            && v.ProfilePictures.OrderByDescending(p => p.Id).FirstOrDefault().Beard >= 0.5).Max(v => v.NbPasses);
-                bestFriends.Add(
-                Table.Include(v => v.Person).Where(v => DbFunctions.TruncateTime(v.Date) >= DbFunctions.TruncateTime(date1)
-                && DbFunctions.TruncateTime(v.Date) <= DbFunctions.TruncateTime(date2)
-                && v.Person.FirstName != null
-                && v.Person.Gender == GenderValues.Male
-                && v.ProfilePictures.OrderByDescending(p => p.Id).FirstOrDefault().Beard >= 0.5).First(v => v.NbPasses == maxPasses)
-                );
-            }
+
+            var bestMale = Table.Include(v => v.Person)
+                                .Where(v => DbFunctions.TruncateTime(v.Date) >= DbFunctions.TruncateTime(date1)
+                                         && DbFunctions.TruncateTime(v.Date) <= DbFunctions.TruncateTime(date2)
+                                         && v.Person.FirstName != null
+                                         && v.Person.Gender == GenderValues.Male)
+                                .OrderByDescending(v => v.NbPasses)
+                                .FirstOrDefault();
+
+            bestFriends.Add(bestMale);
+
+            var bestFemale = Table.Include(v => v.Person)
+                                  .Where(v => DbFunctions.TruncateTime(v.Date) >= DbFunctions.TruncateTime(date1)
+                                              && DbFunctions.TruncateTime(v.Date) <= DbFunctions.TruncateTime(date2)
+                                              && v.Person.FirstName != null
+                                              && v.Person.Gender == GenderValues.Female)
+                                  .OrderByDescending(v => v.NbPasses)
+                                  .FirstOrDefault();
+
+            bestFriends.Add(bestFemale);
+
+            var bestBeard = Table.Include(v => v.Person)
+                                 .Where(v => DbFunctions.TruncateTime(v.Date) >= DbFunctions.TruncateTime(date1)
+                                          && DbFunctions.TruncateTime(v.Date) <= DbFunctions.TruncateTime(date2)
+                                          && v.Person.FirstName != null
+                                          && v.Person.Gender == GenderValues.Male
+                                          && v.ProfilePictures.Average(p => p.Beard) >= 0.5)
+                                 .OrderByDescending(v => v.NbPasses)
+                                 .FirstOrDefault();
+
+            bestFriends.Add(bestBeard);
+
+            // Get all PersonId from people who have on average a indice of 0.5 beard on their pictures.
+            // Context.Set<ProfilePicture>().GroupBy(p => p.Visit.PersonId).Select(g => new { Key = g.Key, Value = g.Average(p => p.Beard) }).Where(g => g.Value > 0.5);
+
             return bestFriends;
         }


CreateDatabase: Remove unnecessary usings

--- CreateDatabase/CreateDatabase/CreateDatabase.cs
+++ CreateDatabase/CreateDatabase/CreateDatabase.cs
@@ -1,10 +1,6 @@
 using System;
-using System.Collections.Generic;
 using System.Data.SQLite;
 using System.IO;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;

 namespace CreateDatabase
 {


新增日期类型测试用例。

新增日期类型测试用例。

--- Sources/Ivony.Data.Test/SqlServerTest.cs
+++ Sources/Ivony.Data.Test/SqlServerTest.cs
@@ -340,6 +340,11 @@
       Assert.AreEqual( db.T( "SELECT TOP 1 XmlContent FROM Test1" ).ExecuteScalar<double?>(), null );
       Assert.AreEqual( db.T( "SELECT TOP 1 XmlContent FROM Test1" ).ExecuteScalar<float?>(), null );
       Assert.AreEqual( db.T( "SELECT TOP 1 XmlContent FROM Test1" ).ExecuteScalar<string>(), null );
+
+      db.T( "INSERT INTO Test1 ( Name, Content, [Index] ) VALUES ( {...} )", "1900/1/2 13:00:05.276", "ABC", 0 ).ExecuteNonQuery();
+      Assert.AreEqual( db.T( "SELECT TOP 1 Name FROM Test1" ).ExecuteScalar<DateTime>(), new DateTime( 1900, 1, 2, 13, 0, 5, 276 ) );
+
+
     }

@@ -348,10 +353,10 @@
     public void EnumTest()
     {

-      db.T( "INSERT INTO Test1 ( Name, Content, [Index] ) VALUES ( {...} )",
+      db.T( "INSERT INTO Test1 ( Name, Content, [Index] ) VALUES ( {...} )",
         TestEnum.One.ToString(), TestEnum.Two.ToString(), TestEnum.Three ).ExecuteNonQuery();
-
-
+
+
       Assert.AreEqual( db.T( "SELECT Name FROM Test1" ).ExecuteScalar<string>(), "One" );
       Assert.AreEqual( db.T( "SELECT [Index] FROM Test1" ).ExecuteScalar<int>(), 3 );
       Assert.AreEqual( db.T( "SELECT Name FROM Test1" ).ExecuteScalar<TestEnum>(), TestEnum.One );


Converted object references in the serialization stack to weak references.

--- DDay.iCal/Serialization/SerializationContext.cs
+++ DDay.iCal/Serialization/SerializationContext.cs
@@ -44,7 +44,7 @@

         #region Private Fields

-        private Stack<object> m_Stack = new Stack<object>();
+        private Stack<WeakReference> m_Stack = new Stack<WeakReference>();
         private ServiceProvider m_ServiceProvider = new ServiceProvider();

         #endregion
@@ -72,20 +72,20 @@
         virtual public void Push(object item)
         {
             if (item != null)
-                m_Stack.Push(item);
+                m_Stack.Push(new WeakReference(item));
         }

         virtual public object Pop()
         {
             if (m_Stack.Count > 0)
-                return m_Stack.Pop();
+                return m_Stack.Pop().Target;
             return null;
         }

         virtual public object Peek()
         {
             if (m_Stack.Count > 0)
-                return m_Stack.Peek();
+                return m_Stack.Peek().Target;
             return null;
         }


feature: append new line after each vcard is serialized a collection.

* fixes #24

--- vCardLib/Serializers/Serializer.cs
+++ vCardLib/Serializers/Serializer.cs
@@ -23,13 +23,14 @@
         /// <returns>A value stating if the serialization was successful or not</returns>
         /// <exception cref="InvalidOperationException">Thrown when the file path exists and the overwrite option is not invoked</exception>
         /// <exception cref="ArgumentNullException">Thrown when the vcard supplied is null</exception>
-        public static bool Serialize(vCard vcard, string filePath, Version version, WriteOptions options = WriteOptions.ThrowError, Encoding encoding = null)
+        public static bool Serialize(vCard vcard, string filePath, Version version,
+            WriteOptions options = WriteOptions.ThrowError, Encoding encoding = null)
         {
             if (encoding == null)
             {
                 encoding = Encoding.Unicode;
             }
-
+
             if (options == WriteOptions.ThrowError)
             {
                 if (File.Exists(filePath))
@@ -42,15 +43,17 @@
                     );
                 }
             }
+
             if (vcard == null)
             {
                 throw new ArgumentNullException("The vcard cannot be null.");
             }
+
             if (version == Version.V2)
             {
                 try
                 {
-					var vcfString = Serialize(vcard, Version.V2);
+                    var vcfString = Serialize(vcard, Version.V2);
                     File.WriteAllText(filePath, vcfString, encoding);
                 }
                 catch (Exception e)
@@ -63,7 +66,7 @@
             {
                 try
                 {
-					var vcfString = Serialize(vcard, Version.V3);
+                    var vcfString = Serialize(vcard, Version.V3);
                     File.WriteAllText(filePath, vcfString, encoding);
                 }
                 catch (Exception e)
@@ -74,10 +77,12 @@
             }
             else if (version == Version.V4)
             {
-				//TODO: once support has been implemented, enable writing capabilities
-				/*string vcfString = */Serialize(vcard, Version.V4);
-				//File.WriteAllText(filePath, vcfString)
-            }
+                //TODO: once support has been implemented, enable writing capabilities
+                /*string vcfString = */
+                Serialize(vcard, Version.V4);
+                //File.WriteAllText(filePath, vcfString)
+            }
+
             return true;
         }

@@ -92,14 +97,14 @@
         /// <returns>A value stating if the serialization was successful or not</returns>
         /// <exception cref="InvalidOperationException">Thrown when the file path exists and the overwrite option is not invoked</exception>
         /// <exception cref="ArgumentNullException">Thrown when the vcard supplied is null</exception>
-        public static bool Serialize(vCardCollection vcardCollection, string filePath, Version version,
+        public static bool Serialize(vCardCollection vcardCollection, string filePath, Version version,
             WriteOptions options = WriteOptions.ThrowError, Encoding encoding = null)
-        {
+        {
             if (encoding == null)
             {
                 encoding = Encoding.Unicode;
             }
-
+
             if (options == WriteOptions.ThrowError)
             {
                 if (File.Exists(filePath))
@@ -112,35 +117,44 @@
                     );
                 }
             }
+
             if (vcardCollection == null)
             {
                 throw new ArgumentNullException("The vcard collection cannot be null.");
             }
-            var vcardCollectionString = "";
-            if (version == Version.V2)
-            {
-                foreach(vCard vcard in vcardCollection)
-                {
-                    vcardCollectionString += Serialize(vcard, Version.V2);
-                }
-            }
-            else if (version == Version.V3)
-            {
-                foreach (vCard vcard in vcardCollection)
-                {
-                    vcardCollectionString += Serialize(vcard, Version.V3);
-                }
-            }
-            else
-            {
-                foreach (vCard vcard in vcardCollection)
-                {
-                    vcardCollectionString += Serialize(vcard, Version.V4);
-                }
-            }
+
+            var vcardCollectionString = new StringBuilder();
+            switch (version)
+            {
+                case Version.V2:
+                    foreach (vCard vcard in vcardCollection)
+                    {
+                        vcardCollectionString.Append(Serialize(vcard, Version.V2));
+                        vcardCollectionString.Append(Environment.NewLine);
+                    }
+
+                    break;
+                case Version.V3:
+                    foreach (vCard vcard in vcardCollection)
+                    {
+                        vcardCollectionString.Append(Serialize(vcard, Version.V3));
+                        vcardCollectionString.Append(Environment.NewLine);
+                    }
+
+                    break;
+                default:
+                    foreach (vCard vcard in vcardCollection)
+                    {
+                        vcardCollectionString.Append(Serialize(vcard, Version.V4));
+                        vcardCollectionString.Append(Environment.NewLine);
+                    }
+
+                    break;
+            }
+
             try
             {
-                File.WriteAllText(filePath, vcardCollectionString, encoding);
+                File.WriteAllText(filePath, vcardCollectionString.ToString(), encoding);
                 return true;
             }
             catch (Exception e)
@@ -155,52 +169,64 @@
             var stringBuilder = new StringBuilder();
             stringBuilder.Append("BEGIN:VCARD" + Environment.NewLine);
             stringBuilder.Append("REV:" + DateTime.Now.ToString("yyyyMMddTHHmmssZ") + Environment.NewLine);
-            stringBuilder.Append("N:" + vcard.FamilyName + ";" + vcard.GivenName + ";" + vcard.MiddleName + ";" + vcard.Prefix + ";" + vcard.Suffix + Environment.NewLine);
+            stringBuilder.Append("N:" + vcard.FamilyName + ";" + vcard.GivenName + ";" + vcard.MiddleName + ";" +
+                                 vcard.Prefix + ";" + vcard.Suffix + Environment.NewLine);
             stringBuilder.Append("FN:" + vcard.FormattedName + Environment.NewLine);
             if (!string.IsNullOrEmpty(vcard.Organization))
             {
                 stringBuilder.Append("ORG:" + vcard.Organization + Environment.NewLine);
             }
+
             if (!string.IsNullOrEmpty(vcard.Title))
             {
                 stringBuilder.Append("TITLE:" + vcard.Title + Environment.NewLine);
             }
+
             if (!string.IsNullOrEmpty(vcard.Url))
             {
                 stringBuilder.Append("URL:" + vcard.Url + Environment.NewLine);
             }
+
             if (!string.IsNullOrEmpty(vcard.NickName))
             {
                 stringBuilder.Append("NICKNAME:" + vcard.NickName + Environment.NewLine);
             }
+
             if (!string.IsNullOrEmpty(vcard.Language))
             {
                 stringBuilder.Append("LANG:" + vcard.Language + Environment.NewLine);
             }
+
             if (!string.IsNullOrEmpty(vcard.BirthPlace))
             {
                 stringBuilder.Append("BIRTHPLACE:" + vcard.BirthPlace + Environment.NewLine);
             }
+
             if (!string.IsNullOrEmpty(vcard.DeathPlace))
             {
                 stringBuilder.Append("DEATHPLACE:" + vcard.DeathPlace + Environment.NewLine);
             }
+
             if (!string.IsNullOrEmpty(vcard.TimeZone))
             {
                 stringBuilder.Append("TZ:" + vcard.TimeZone + Environment.NewLine);
             }
+
             if (!string.IsNullOrEmpty(vcard.Note))
             {
                 stringBuilder.Append("NOTE:" + vcard.Note);
             }
+
             if (!string.IsNullOrEmpty(vcard.XSkypeDisplayName))
             {
                 stringBuilder.Append("X-SKYPE-DISPLAYNAME:" + vcard.XSkypeDisplayName + Environment.NewLine);
             }
+
             if (!string.IsNullOrEmpty(vcard.XSkypePstnNumber))
             {
                 stringBuilder.Append("X-SKYPE-PSTNNUMBER:" + vcard.XSkypePstnNumber + Environment.NewLine);
             }
+
             stringBuilder.Append("KIND:" + vcard.Kind.ToString().ToUpper() + Environment.NewLine);
             stringBuilder.Append("GENDER:" + vcard.Gender.ToString().ToUpper() + Environment.NewLine);

@@ -208,10 +234,12 @@
             {
                 stringBuilder.Append("GEO:" + vcard.Geo.Longitude + ";" + vcard.Geo.Latitude);
             }
+
             if (vcard.BirthDay != null)
             {
                 var birthDay = (DateTime) vcard.BirthDay;
-                stringBuilder.Append("BDAY:" + birthDay.Year + birthDay.Month.ToString("00") + birthDay.Day.ToString("00"));
+                stringBuilder.Append("BDAY:" + birthDay.Year + birthDay.Month.ToString("00") +
+                                     birthDay.Day.ToString("00"));
             }

             if (version == Version.V2)
@@ -229,9 +257,10 @@
                 stringBuilder.Append("VERSION:4.0" + Environment.NewLine);
                 stringBuilder.Append(V4Serializer.Serialize(vcard));
             }
+
             stringBuilder.Append(Environment.NewLine);
             stringBuilder.Append("END:VCARD");
             return stringBuilder.ToString();
         }
     }
-}
+}


Provide a buffer to MemoryStream

Provide a buffer to MemoryStream

NetStandard 1.3 doesn't expose .GetBuffer(), this removes the need for
having it. The support for messages that span TPKT's is quite nasty, but
probably S7 PLC's will never even use a message spanning multiple TPKT's.

--- S7.Net/COTP.cs
+++ S7.Net/COTP.cs
@@ -98,15 +98,20 @@
                 var segment = TPDU.Read(stream);
                 if (segment == null) return null;

-                var output = new MemoryStream(segment.Data.Length);
+                var buffer = new byte[segment.Data.Length];
+                var output = new MemoryStream(buffer);
                 output.Write(segment.Data, 0, segment.Data.Length);

                 while (!segment.LastDataUnit)
                 {
                     segment = TPDU.Read(stream);
-                    output.Write(segment.Data, (int)output.Position, segment.Data.Length);
+                    Array.Resize(ref buffer, buffer.Length + segment.Data.Length);
+                    var lastPosition = output.Position;
+                    output = new MemoryStream(buffer);
+                    output.Write(segment.Data, (int) lastPosition, segment.Data.Length);
                 }
-                return output.GetBuffer().Take((int)output.Position).ToArray();
+
+                return buffer.Take((int)output.Position).ToArray();
             }

             /// <summary>
@@ -120,15 +125,19 @@
                 var segment = await TPDU.ReadAsync(stream);
                 if (segment == null) return null;

-                var output = new MemoryStream(segment.Data.Length);
+                var buffer = new byte[segment.Data.Length];
+                var output = new MemoryStream(buffer);
                 output.Write(segment.Data, 0, segment.Data.Length);

                 while (!segment.LastDataUnit)
                 {
                     segment = await TPDU.ReadAsync(stream);
-                    output.Write(segment.Data, (int)output.Position, segment.Data.Length);
+                    Array.Resize(ref buffer, buffer.Length + segment.Data.Length);
+                    var lastPosition = output.Position;
+                    output = new MemoryStream(buffer);
+                    output.Write(segment.Data, (int) lastPosition, segment.Data.Length);
                 }
-                return output.GetBuffer().Take((int)output.Position).ToArray();
+                return buffer.Take((int)output.Position).ToArray();
             }
         }
     }