Convert to NFluent

Convert to NFluent

--- src/Pickles/Pickles.Test/WhenParsingCommandLineArguments.cs
+++ src/Pickles/Pickles.Test/WhenParsingCommandLineArguments.cs
@@ -13,7 +13,7 @@
   [TestFixture]
   public class WhenParsingCommandLineArguments : BaseFixture
   {
-    private const string expectedHelpString = @"  -f, --feature-directory=VALUE
+    private const string ExpectedHelpString = @"  -f, --feature-directory=VALUE
                              directory to start scanning recursively for
                                features
   -o, --output-directory=VALUE
@@ -37,7 +37,7 @@

     private const string CurrentDirectory = @"C:\Foo\Bar"; // this is the default current directory of MockFileSystem

-    private static readonly string expectedVersionString =
+    private static readonly string ExpectedVersionString =
         string.Format(@"Pickles version {0}", Assembly.GetExecutingAssembly().GetName().Version);

     [Test]
@@ -77,11 +77,16 @@
       bool shouldContinue = commandLineArgumentParser.Parse(args, configuration, writer);

-      StringAssert.Contains(expectedHelpString.ComparisonNormalize(),
-                            writer.GetStringBuilder().ToString().ComparisonNormalize());
+      var actual = RetrieveString(writer);
+      Check.That(actual).Contains(ExpectedHelpString.ComparisonNormalize());
       Check.That(shouldContinue).IsFalse();
     }

+    private static string RetrieveString(StringWriter writer)
+    {
+      return writer.GetStringBuilder().ToString().ComparisonNormalize();
+    }
+
     [Test]
     public void ThenCanParseHelpRequestWithQuestionMarkSuccessfully()
     {
@@ -92,8 +97,8 @@
       var commandLineArgumentParser = new CommandLineArgumentParser(FileSystem);
       bool shouldContinue = commandLineArgumentParser.Parse(args, configuration, writer);

-      StringAssert.Contains(expectedHelpString.ComparisonNormalize(),
-                            writer.GetStringBuilder().ToString().ComparisonNormalize());
+      var actual = RetrieveString(writer);
+      Check.That(actual).Contains(ExpectedHelpString.ComparisonNormalize());
       Check.That(shouldContinue).IsFalse();
     }

@@ -107,8 +112,8 @@
       var commandLineArgumentParser = new CommandLineArgumentParser(FileSystem);
       bool shouldContinue = commandLineArgumentParser.Parse(args, configuration, writer);

-      StringAssert.Contains(expectedHelpString.ComparisonNormalize(),
-                            writer.GetStringBuilder().ToString().ComparisonNormalize());
+      var actual = RetrieveString(writer);
+      Check.That(actual).Contains(ExpectedHelpString.ComparisonNormalize());
       Check.That(shouldContinue).IsFalse();
     }

@@ -122,8 +127,8 @@
       bool shouldContinue = commandLineArgumentParser.Parse(args, configuration, TextWriter.Null);

       Check.That(shouldContinue).IsTrue();
-      Assert.AreEqual(@"c:\features", configuration.FeatureFolder.FullName);
-      Assert.AreEqual(@"c:\features-output", configuration.OutputFolder.FullName);
+      Check.That(configuration.FeatureFolder.FullName).IsEqualTo(@"c:\features");
+      Check.That(configuration.OutputFolder.FullName).IsEqualTo(@"c:\features-output");
     }

     [Test]
@@ -138,7 +143,7 @@

       Check.That(shouldContinue).IsTrue();
       Check.That(configuration.HasTestResults).IsTrue();
-      Assert.AreEqual(@"c:\results.xml", configuration.TestResultsFile.FullName);
+      Check.That(configuration.TestResultsFile.FullName).IsEqualTo(@"c:\results.xml");
     }

     [Test]
@@ -154,8 +159,8 @@

       Check.That(shouldContinue).IsTrue();
       Check.That(configuration.HasTestResults).IsTrue();
-      Assert.AreEqual(@"c:\results1.xml", configuration.TestResultsFiles.First().FullName);
-      Assert.AreEqual(@"c:\results2.xml", configuration.TestResultsFiles.Skip(1).First().FullName);
+      Check.That(configuration.TestResultsFiles.First().FullName).IsEqualTo(@"c:\results1.xml");
+      Check.That(configuration.TestResultsFiles.Skip(1).First().FullName).IsEqualTo(@"c:\results2.xml");
     }

     [Test]
@@ -171,8 +176,8 @@

       Check.That(shouldContinue).IsTrue();
       Check.That(configuration.HasTestResults).IsTrue();
-      Assert.AreEqual(@"c:\results1.xml", configuration.TestResultsFile.FullName);
-      Assert.AreEqual(@"c:\results1.xml", configuration.TestResultsFiles.First().FullName);
+      Check.That(configuration.TestResultsFile.FullName).IsEqualTo(@"c:\results1.xml");
+      Check.That(configuration.TestResultsFiles.First().FullName).IsEqualTo(@"c:\results1.xml");
     }

     [Test]
@@ -187,8 +192,8 @@

       Check.That(shouldContinue).IsTrue();
       Check.That(configuration.HasTestResults).IsTrue();
-      Assert.AreEqual(1, configuration.TestResultsFiles.Count());
-      Assert.AreEqual(@"c:\results1.xml", configuration.TestResultsFiles.First().FullName);
+      Check.That(configuration.TestResultsFiles.Count()).IsEqualTo(1);
+      Check.That(configuration.TestResultsFiles.First().FullName).IsEqualTo(@"c:\results1.xml");
     }

     [Test]
@@ -203,8 +208,8 @@

       Check.That(shouldContinue).IsTrue();
       Check.That(configuration.HasTestResults).IsTrue();
-      Assert.AreEqual(1, configuration.TestResultsFiles.Count());
-      Assert.AreEqual(@"c:\results1.xml", configuration.TestResultsFiles.First().FullName);
+      Check.That(configuration.TestResultsFiles.Count()).IsEqualTo(1);
+      Check.That(configuration.TestResultsFiles.First().FullName).IsEqualTo(@"c:\results1.xml");
     }

     [Test]
@@ -219,7 +224,7 @@

       Check.That(shouldContinue).IsTrue();
       Check.That(configuration.HasTestResults).IsTrue();
-      Assert.AreEqual(@"c:\results.xml", configuration.TestResultsFile.FullName);
+      Check.That(configuration.TestResultsFile.FullName).IsEqualTo(@"c:\results.xml");
     }

     [Test]
@@ -232,7 +237,7 @@
       bool shouldContinue = commandLineArgumentParser.Parse(args, configuration, TextWriter.Null);

       Check.That(shouldContinue).IsTrue();
-      Assert.AreEqual(TestResultsFormat.MsTest, configuration.TestResultsFormat);
+      Check.That(configuration.TestResultsFormat).IsEqualTo(TestResultsFormat.MsTest);
     }

     [Test]
@@ -245,7 +250,7 @@
       bool shouldContinue = commandLineArgumentParser.Parse(args, configuration, TextWriter.Null);

       Check.That(shouldContinue).IsTrue();
-      Assert.AreEqual(TestResultsFormat.MsTest, configuration.TestResultsFormat);
+      Check.That(configuration.TestResultsFormat).IsEqualTo(TestResultsFormat.MsTest);
     }

     [Test]
@@ -258,7 +263,7 @@
       bool shouldContinue = commandLineArgumentParser.Parse(args, configuration, TextWriter.Null);

       Check.That(shouldContinue).IsTrue();
-      Assert.AreEqual(TestResultsFormat.NUnit, configuration.TestResultsFormat);
+      Check.That(configuration.TestResultsFormat).IsEqualTo(TestResultsFormat.NUnit);
     }

     [Test]
@@ -271,7 +276,7 @@
       bool shouldContinue = commandLineArgumentParser.Parse(args, configuration, TextWriter.Null);

       Check.That(shouldContinue).IsTrue();
-      Assert.AreEqual(TestResultsFormat.NUnit, configuration.TestResultsFormat);
+      Check.That(configuration.TestResultsFormat).IsEqualTo(TestResultsFormat.NUnit);
     }

     [Test]
@@ -284,7 +289,7 @@
       bool shouldContinue = commandLineArgumentParser.Parse(args, configuration, TextWriter.Null);

       Check.That(shouldContinue).IsTrue();
-      Assert.AreEqual(TestResultsFormat.xUnit, configuration.TestResultsFormat);
+      Check.That(configuration.TestResultsFormat).IsEqualTo(TestResultsFormat.xUnit);
     }

     [Test]
@@ -297,7 +302,7 @@
       bool shouldContinue = commandLineArgumentParser.Parse(args, configuration, TextWriter.Null);

       Check.That(shouldContinue).IsTrue();
-      Assert.AreEqual(TestResultsFormat.xUnit, configuration.TestResultsFormat);
+      Check.That(configuration.TestResultsFormat).IsEqualTo(TestResultsFormat.xUnit);
     }

     [Test]
@@ -310,8 +315,8 @@
       bool shouldContinue = commandLineArgumentParser.Parse(args, configuration, TextWriter.Null);

       Check.That(shouldContinue).IsTrue();
-      Assert.AreEqual(@"c:\features", configuration.FeatureFolder.FullName);
-      Assert.AreEqual(@"c:\features-output", configuration.OutputFolder.FullName);
+      Check.That(configuration.FeatureFolder.FullName).IsEqualTo(@"c:\features");
+      Check.That(configuration.OutputFolder.FullName).IsEqualTo(@"c:\features-output");
     }

     [Test]
@@ -324,8 +329,8 @@
       var commandLineArgumentParser = new CommandLineArgumentParser(FileSystem);
       bool shouldContinue = commandLineArgumentParser.Parse(args, configuration, writer);

-      StringAssert.IsMatch(expectedVersionString.ComparisonNormalize(),
-                           writer.GetStringBuilder().ToString().ComparisonNormalize());
+      var actual = RetrieveString(writer);
+      Check.That(actual).Contains(ExpectedVersionString.ComparisonNormalize());
       Check.That(shouldContinue).IsFalse();
     }

@@ -339,8 +344,8 @@
       var commandLineArgumentParser = new CommandLineArgumentParser(FileSystem);
       bool shouldContinue = commandLineArgumentParser.Parse(args, configuration, writer);

-      StringAssert.IsMatch(expectedVersionString.ComparisonNormalize(),
-                           writer.GetStringBuilder().ToString().ComparisonNormalize());
+      var actual = RetrieveString(writer);
+      Check.That(actual).Contains(ExpectedVersionString.ComparisonNormalize());
       Check.That(shouldContinue).IsFalse();
     }

@@ -354,8 +359,8 @@
       var commandLineArgumentParser = new CommandLineArgumentParser(FileSystem);
       commandLineArgumentParser.Parse(args, configuration, writer);

-      Assert.AreEqual(CurrentDirectory, configuration.FeatureFolder.FullName);
-      Assert.AreEqual(CurrentDirectory, configuration.OutputFolder.FullName);
+      Check.That(configuration.FeatureFolder.FullName).IsEqualTo(CurrentDirectory);
+      Check.That(configuration.OutputFolder.FullName).IsEqualTo(CurrentDirectory);
     }

     [Test]
@@ -368,7 +373,7 @@
       bool shouldContinue = commandLineArgumentParser.Parse(args, configuration, TextWriter.Null);

       Check.That(shouldContinue).IsTrue();
-      Assert.AreEqual(TestResultsFormat.CucumberJson, configuration.TestResultsFormat);
+      Check.That(configuration.TestResultsFormat).IsEqualTo(TestResultsFormat.CucumberJson);
     }

     [Test]
@@ -381,7 +386,7 @@
       bool shouldContinue = commandLineArgumentParser.Parse(args, configuration, TextWriter.Null);

       Check.That(shouldContinue).IsTrue();
-      Assert.AreEqual(TestResultsFormat.CucumberJson, configuration.TestResultsFormat);
+      Check.That(configuration.TestResultsFormat).IsEqualTo(TestResultsFormat.CucumberJson);
     }

     [Test]
@@ -394,7 +399,7 @@
       bool shouldContinue = commandLineArgumentParser.Parse(args, configuration, TextWriter.Null);

       Check.That(shouldContinue).IsTrue();
-      Assert.AreEqual(TestResultsFormat.SpecRun, configuration.TestResultsFormat);
+      Check.That(configuration.TestResultsFormat).IsEqualTo(TestResultsFormat.SpecRun);
     }

     [Test]
@@ -407,7 +412,7 @@
       bool shouldContinue = commandLineArgumentParser.Parse(args, configuration, TextWriter.Null);

       Check.That(shouldContinue).IsTrue();
-      Assert.AreEqual(TestResultsFormat.SpecRun, configuration.TestResultsFormat);
+      Check.That(configuration.TestResultsFormat).IsEqualTo(TestResultsFormat.SpecRun);
     }

     [Test]
@@ -421,7 +426,7 @@

       Check.That(shouldContinue).IsTrue();
       Check.That(configuration.HasTestResults).IsFalse();
-      Assert.AreEqual(0, configuration.TestResultsFiles.Count());
+      Check.That(configuration.TestResultsFiles).IsEmpty();
     }
   }
 }


Up the SignalR test timeout to match Kestrel's (#8563)

--- src/SignalR/common/testassets/Tests.Utils/TaskExtensions.cs
+++ src/SignalR/common/testassets/Tests.Utils/TaskExtensions.cs
@@ -15,7 +15,7 @@
 #endif
     static class TaskExtensions
     {
-        private const int DefaultTimeout = 5000;
+        private const int DefaultTimeout = 30 * 1000;

         public static Task OrTimeout(this Task task, int milliseconds = DefaultTimeout, [CallerMemberName] string memberName = null, [CallerFilePath] string filePath = null, [CallerLineNumber] int? lineNumber = null)
         {


Bump css version

Bump css version

--- src/Swetugg.Web/Areas/Sthlm2023/Views/Shared/_Layout.cshtml
+++ src/Swetugg.Web/Areas/Sthlm2023/Views/Shared/_Layout.cshtml
@@ -43,7 +43,7 @@
     <link href="//netdna.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css" rel="stylesheet" type="text/css">
     <link href="//netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.min.css" rel="stylesheet" type="text/css">

-    <link href="/Content/sthlm-2023/css/swetugg.css?v=2" rel="stylesheet">
+    <link href="/Content/sthlm-2023/css/swetugg.css?v=3" rel="stylesheet">

     <!--
     To collect end-user usage analytics about your application,


Pass selected severity

Pass selected severity

--- src/Analyzers/CSharp/Analyzers/UsePatternCombinators/CSharpUsePatternCombinatorsDiagnosticAnalyzer.cs
+++ src/Analyzers/CSharp/Analyzers/UsePatternCombinators/CSharpUsePatternCombinatorsDiagnosticAnalyzer.cs
@@ -103,11 +103,10 @@

             context.ReportDiagnostic(DiagnosticHelper.Create(
                 Descriptor,
-                location: expression.GetLocation(),
-                effectiveSeverity: ReportDiagnostic.Warn,
+                expression.GetLocation(),
+                styleOption.Notification.Severity,
                 additionalLocations: null,
-                properties: null,
-                messageArgs: null));
+                properties: null));
         }

         private static bool HasIllegalPatternVariables(AnalyzedPattern pattern, bool permitDesignations = true)


Added current type level to comment field

--- src/FreecraftCore.Serializer.Compiler/Emitters/Statements/FieldDocumentationStatementsBlockEmitter.cs
+++ src/FreecraftCore.Serializer.Compiler/Emitters/Statements/FieldDocumentationStatementsBlockEmitter.cs
@@ -28,7 +28,7 @@

 			//This is a HACK (including the slashes) but I am too dumb to figure out another way lol.
 			statements.Add(EmptyStatement()
-				.WithLeadingTrivia(Comment($"//Field: {fieldId} Name: {Member.Name} Type: {ActualType.Name}")));
+				.WithLeadingTrivia(Comment($"//Type: {Member.DeclaringType.Name} Field: {fieldId} Name: {Member.Name} Type: {ActualType.Name}")));

 			return statements;
 		}


Fix formatting

Fix formatting

--- src/NetAnalyzers/Core/Microsoft.NetCore.Analyzers/Security/UseDefaultDllImportSearchPathsAttribute.cs
+++ src/NetAnalyzers/Core/Microsoft.NetCore.Analyzers/Security/UseDefaultDllImportSearchPathsAttribute.cs
@@ -23,7 +23,7 @@
             RuleLevel.Disabled,
             isPortedFxCopRule: false,
             isDataflowRule: false,
-                isReportedAtCompilationEnd: false,
+            isReportedAtCompilationEnd: false,
             descriptionResourceStringName: nameof(MicrosoftNetCoreAnalyzersResources.UseDefaultDllImportSearchPathsAttributeDescription));
         internal static DiagnosticDescriptor DoNotUseUnsafeDllImportSearchPathRule = SecurityHelpers.CreateDiagnosticDescriptor(
             "CA5393",
@@ -32,7 +32,7 @@
             RuleLevel.Disabled,
             isPortedFxCopRule: false,
             isDataflowRule: false,
-                isReportedAtCompilationEnd: false,
+            isReportedAtCompilationEnd: false,
             descriptionResourceStringName: nameof(MicrosoftNetCoreAnalyzersResources.DoNotUseUnsafeDllImportSearchPathDescription));

         // DllImportSearchPath.AssemblyDirectory = 2.


Fixed CanWrite check logic.

Fixed CanWrite check logic.

--- src/proj/EventStore.Core/OptimisticEventStore.cs
+++ src/proj/EventStore.Core/OptimisticEventStore.cs
@@ -35,7 +35,7 @@
 			if (stream == null)
 				return false;

-			return (stream.Events != null && stream.Events.Count > 0) || stream.Snapshot != null;
+			return stream.Snapshot != null || stream.Events != null && stream.Events.Count > 0;
 		}
 		private void WrapAndThrow(UncommittedEventStream stream, Exception innerException)
 		{


Improved existing functional tests to check the response's status code

--- tests/JSend.WebApi.FunctionalTests/HttpActionResultTests.cs
+++ tests/JSend.WebApi.FunctionalTests/HttpActionResultTests.cs
@@ -1,4 +1,5 @@
-using System.Net.Http;
+using System.Net;
+using System.Net.Http;
 using System.Threading.Tasks;
 using System.Web.Http;
 using FluentAssertions;
@@ -29,6 +30,8 @@
                 // Verify outcome
                 var content = JToken.Parse(await response.Content.ReadAsStringAsync());
                 JToken.DeepEquals(expectedContent, content).Should().BeTrue();
+
+                response.StatusCode.Should().Be(HttpStatusCode.OK);
             }
         }

@@ -51,6 +54,8 @@
                 // Verify outcome
                 var content = JToken.Parse(await response.Content.ReadAsStringAsync());
                 JToken.DeepEquals(expectedContent, content).Should().BeTrue();
+
+                response.StatusCode.Should().Be(HttpStatusCode.OK);
             }
         }

@@ -73,7 +78,10 @@
                 // Verify outcome
                 var content = JToken.Parse(await response.Content.ReadAsStringAsync());
                 JToken.DeepEquals(expectedContent, content).Should().BeTrue();
-                response.Headers.Location.Should().Be(UsersController.CreatedLocation);
+
+                response.Headers.Location.Should().Be(UsersController.CreatedLocation);
+
+                response.StatusCode.Should().Be(HttpStatusCode.Created);
             }
         }

@@ -96,7 +104,10 @@
                 // Verify outcome
                 var content = JToken.Parse(await response.Content.ReadAsStringAsync());
                 JToken.DeepEquals(expectedContent, content).Should().BeTrue();
-                response.Headers.Location.Should().Be(UsersController.CreatedLocation);
+
+                response.Headers.Location.Should().Be(UsersController.CreatedLocation);
+
+                response.StatusCode.Should().Be(HttpStatusCode.Created);
             }
         }

@@ -119,7 +130,10 @@
                 // Verify outcome
                 var content = JToken.Parse(await response.Content.ReadAsStringAsync());
                 JToken.DeepEquals(expectedContent, content).Should().BeTrue();
-                response.Headers.Location.Should().Be(UsersController.CreatedLocation);
+
+                response.Headers.Location.Should().Be(UsersController.CreatedLocation);
+
+                response.StatusCode.Should().Be(HttpStatusCode.Created);
             }
         }

@@ -142,7 +156,10 @@
                 // Verify outcome
                 var content = JToken.Parse(await response.Content.ReadAsStringAsync());
                 JToken.DeepEquals(expectedContent, content).Should().BeTrue();
-                response.Headers.Location.Should().Be(UsersController.CreatedLocation);
+
+                response.Headers.Location.Should().Be(UsersController.CreatedLocation);
+
+                response.StatusCode.Should().Be(HttpStatusCode.Created);
             }
         }

@@ -165,7 +182,10 @@
                 // Verify outcome
                 var content = JToken.Parse(await response.Content.ReadAsStringAsync());
                 JToken.DeepEquals(expectedContent, content).Should().BeTrue();
-                response.Headers.Location.Should().Be(UsersController.CreatedLocation);
+
+                response.Headers.Location.Should().Be(UsersController.CreatedLocation);
+
+                response.StatusCode.Should().Be(HttpStatusCode.Redirect);
             }
         }

@@ -188,7 +208,10 @@
                 // Verify outcome
                 var content = JToken.Parse(await response.Content.ReadAsStringAsync());
                 JToken.DeepEquals(expectedContent, content).Should().BeTrue();
-                response.Headers.Location.Should().Be(UsersController.CreatedLocation);
+
+                response.Headers.Location.Should().Be(UsersController.CreatedLocation);
+
+                response.StatusCode.Should().Be(HttpStatusCode.Redirect);
             }
         }

@@ -211,7 +234,10 @@
                 // Verify outcome
                 var content = JToken.Parse(await response.Content.ReadAsStringAsync());
                 JToken.DeepEquals(expectedContent, content).Should().BeTrue();
-                response.Headers.Location.Should().Be(UsersController.CreatedLocation);
+
+                response.Headers.Location.Should().Be(UsersController.CreatedLocation);
+
+                response.StatusCode.Should().Be(HttpStatusCode.Redirect);
             }
         }

@@ -234,7 +260,10 @@
                 // Verify outcome
                 var content = JToken.Parse(await response.Content.ReadAsStringAsync());
                 JToken.DeepEquals(expectedContent, content).Should().BeTrue();
-                response.Headers.Location.Should().Be(UsersController.CreatedLocation);
+
+                response.Headers.Location.Should().Be(UsersController.CreatedLocation);
+
+                response.StatusCode.Should().Be(HttpStatusCode.Redirect);
             }
         }
     }


Fix deadlocks in outer loop task tests

Fix deadlocks in outer loop task tests

The TaskRunSyncTests tests are creating a custom TaskScheduler that spins up a bunch of threads, and then when the scheduler is disposed, it prevents additional tasks from being queued, empties the queue of remaining tasks, and waits for its threads to complete (meaning waiting for any currently running tasks to exit).

A few of the TaskRunSyncTests tests are creating tasks that, when executed, create their own scheduler to run a child task on.  This scheduler needs to be disposed (because it's another of these custom TaskSchedulers that needs to be shut down), so a continuation off of the child task is created to dispose of the child scheduler.

There are a two problems here.
- By the time this continuation is queued, the parent scheduler may have already had shutdown requested, in which case the continuation can't be queued to it, and the scheduler can't be shutdown.  Fix: Schedule the continuation to the thread pool rather than to the parent scheduler.
- The child scheduler is being created to target the parent scheduler.  I don't know if that was by design or if it was an accident, but it's a recipe for deadlock if any users of these tests were to run concurrently, as then multiple child schedulers expecting a specific number of workers might get fewer than that.  More importantly, this contributes to the previous issue: because the child scheduler was created on top of the parent, the parent couldn't shut down its threads until the child shut down its threads, but the child didn't know to shut down its threads because the continuation scheduled to the parent couldn't run.  Fix: Have the schedulers always target the thread pool rather than targeting the parent.

--- src/System.Threading.Tasks/tests/Task/TaskRunSyncTests.cs
+++ src/System.Threading.Tasks/tests/Task/TaskRunSyncTests.cs
@@ -71,12 +71,11 @@
             AbleToExecuteInline = ableToExecuteInline;

             /*need at least two threads since we might schedule two tasks (parent-child)*/
-            const int minThreads = 2;
-            int numberOfThreads = Environment.ProcessorCount > minThreads ? Environment.ProcessorCount : minThreads;
+            int numberOfThreads = Math.Max(Environment.ProcessorCount, 2);
             _threads = new Task[numberOfThreads];
             for (int i = 0; i < numberOfThreads; i++)
             {
-                Task t = new Task(() =>
+                _threads[i] = Task.Run(() =>
                 {
                     foreach (var task in _tasks.GetConsumingEnumerable())
                     {
@@ -86,9 +85,6 @@
                         }
                     }
                 });
-
-                t.Start();
-                _threads[i] = t;
             }
         }

@@ -374,7 +370,7 @@

                     case WorkloadType.RunWithUserScheduler:
                         TaskScheduler ts = new TaskRunSyncTaskScheduler(true);
-                        Task.Factory.StartNew(() => { }, _cts.Token, TaskCreationOptions.AttachedToParent, ts).ContinueWith((task) => DisposeScheduler(ts));
+                        Task.Factory.StartNew(() => { }, _cts.Token, TaskCreationOptions.AttachedToParent, ts).ContinueWith((task) => DisposeScheduler(ts), TaskScheduler.Default);
                         break;

                     case WorkloadType.ThrowException:


Cleanup.

Cleanup.

--- src/TestFx.SpecK.Tests/Setups/SimpleSetupExecutionTest.cs
+++ src/TestFx.SpecK.Tests/Setups/SimpleSetupExecutionTest.cs
@@ -27,7 +27,7 @@
     [Subject (typeof (SimpleSetupExecutionTest))]
     internal class DomainSpec : Spec<object>
     {
-      [AssemblySetup] public static readonly MyAssemblySetup MyAssemblySetup;
+      [AssemblySetup] public static MyAssemblySetup MyAssemblySetup;

       public DomainSpec ()
       {
@@ -43,13 +43,13 @@
                 .GivenSubject ("static subject2", x => Subject2));
       }

-      static void SetupOnceMethod ()
+      void SetupOnceMethod ()
       {
         MyAssemblySetup.Should ().NotBeNull ();
         SetupOnceAction1 ();
       }

-      static void CleanupOnceMethod ()
+      void CleanupOnceMethod ()
       {
         MyAssemblySetup.Should ().NotBeNull ();
         CleanupOnceAction1 ();


Restyled with ReSharper.

Restyled with ReSharper.

git-svn-id: e9d5f5868683eccc270aa6b17843cd4a1d89aaa6@1474 90d2b0b2-0e11-ba47-89f1-85e69862abc4

--- src/Uncas.BuildPipeline.Web/Controllers/HomeController.cs
+++ src/Uncas.BuildPipeline.Web/Controllers/HomeController.cs
@@ -1,8 +1,10 @@
 namespace Uncas.BuildPipeline.Web.Controllers
 {
+    using System.Collections.Generic;
     using System.Linq;
     using System.Web.Mvc;
     using Uncas.BuildPipeline.ApplicationServices;
+    using Uncas.BuildPipeline.Models;
     using Uncas.BuildPipeline.Repositories;
     using Uncas.BuildPipeline.Web.Mappers;
     using Uncas.BuildPipeline.Web.ViewModels;
@@ -10,61 +12,60 @@
     public class HomeController : BaseController
     {
         private const int BuildPageSize = 10;
-
-        private readonly IEnvironmentRepository environmentRepository;
-        private readonly IPipelineRepository pipelineRepository;
-        private readonly IDeploymentService deploymentService;
+        private readonly IDeploymentService _deploymentService;
+        private readonly IEnvironmentRepository _environmentRepository;
+        private readonly IPipelineRepository _pipelineRepository;

         public HomeController()
         {
-            this.environmentRepository = Bootstrapper.Resolve<IEnvironmentRepository>();
-            this.deploymentService = Bootstrapper.Resolve<IDeploymentService>();
-            this.pipelineRepository = Bootstrapper.Resolve<IPipelineRepository>();
+            _environmentRepository = Bootstrapper.Resolve<IEnvironmentRepository>();
+            _deploymentService = Bootstrapper.Resolve<IDeploymentService>();
+            _pipelineRepository = Bootstrapper.Resolve<IPipelineRepository>();
         }

         [HttpGet]
         public ActionResult Index()
         {
-            var pipelines = this.pipelineRepository.GetPipelines(BuildPageSize);
-            var viewModel = PipelineMapper.MapToPipelineIndexViewModel(pipelines);
+            IEnumerable<Pipeline> pipelines = _pipelineRepository.GetPipelines(BuildPageSize);
+            PipelineIndexViewModel viewModel = PipelineMapper.MapToPipelineIndexViewModel(pipelines);
             return View(viewModel);
         }

         [HttpGet]
         public ActionResult Deploy(int pipelineId)
         {
-            var environments = this.environmentRepository.GetEnvironments();
-            var pipeline = this.pipelineRepository.GetPipeline(pipelineId);
-            var deployments = this.deploymentService.GetDeployments(pipelineId);
-            var environmentViewModels = environments.Select(
+            IEnumerable<Environment> environments = _environmentRepository.GetEnvironments();
+            Pipeline pipeline = _pipelineRepository.GetPipeline(pipelineId);
+            IEnumerable<Deployment> deployments = _deploymentService.GetDeployments(pipelineId);
+            IEnumerable<EnvironmentViewModel> environmentViewModels = environments.Select(
                 e => new EnvironmentViewModel
-            {
-                EnvironmentId = e.Id,
-                EnvironmentName = e.EnvironmentName
-            });
-            var pipelineViewModel = PipelineMapper.MapToPipelineViewModel(pipeline);
+                         {
+                             EnvironmentId = e.Id,
+                             EnvironmentName = e.EnvironmentName
+                         });
+            PipelineViewModel pipelineViewModel = PipelineMapper.MapToPipelineViewModel(pipeline);
             var deployViewModel = new DeployViewModel
-            {
-                Environments = environmentViewModels,
-                Deployments = deployments.Select(
-                    d => new DeploymentViewModel
-                    {
-                        Created = d.Created,
-                        Started = d.Started,
-                        Completed = d.Completed,
-                        EnvironmentName = environments.FirstOrDefault(
-                            e => e.Id == d.EnvironmentId).EnvironmentName
-                    }),
-                Pipeline = pipelineViewModel
-            };
+                                      {
+                                          Environments = environmentViewModels,
+                                          Deployments = deployments.Select(
+                                              d => new DeploymentViewModel
+                                                       {
+                                                           Created = d.Created,
+                                                           Started = d.Started,
+                                                           Completed = d.Completed,
+                                                           EnvironmentName = environments.FirstOrDefault(
+                                                               e => e.Id == d.EnvironmentId).EnvironmentName
+                                                       }),
+                                          Pipeline = pipelineViewModel
+                                      };
             return View(deployViewModel);
         }

         [HttpPost]
         public ActionResult Deploy(int environmentId, int pipelineId)
         {
-            this.deploymentService.ScheduleDeployment(pipelineId, environmentId);
-            return RedirectToAction("Deploy", new { PipelineId = pipelineId });
+            _deploymentService.ScheduleDeployment(pipelineId, environmentId);
+            return RedirectToAction("Deploy", new {PipelineId = pipelineId});
         }

         [HttpGet]


[tests] TaskItem_Tests.Escaping{2,3} - Disable Task Host tests for ..

.. mono/osx.

--- src/XMakeBuildEngine/UnitTests/Instance/TaskItem_Tests.cs
+++ src/XMakeBuildEngine/UnitTests/Instance/TaskItem_Tests.cs
@@ -217,7 +217,7 @@
         /// <summary>
         /// Flushing an item through a task run in the task host also should not mess up special characters on the metadata.
         /// </summary>
-#if RUNTIME_TYPE_NETCORE
+#if RUNTIME_TYPE_NETCORE || MONO
         [Fact(Skip = "FEATURE: TASKHOST")]
 #else
         [Fact]
@@ -278,7 +278,7 @@
         /// <summary>
         /// Flushing an item through a task run in the task host also should not mess up the escaping of the itemspec either.
         /// </summary>
-#if RUNTIME_TYPE_NETCORE
+#if RUNTIME_TYPE_NETCORE || MONO
         [Fact(Skip = "FEATURE: TASKHOST")]
 #else
         [Fact]


Apply DataContractAttribute or object cannot be serialized to

--- src/YoulessNet/YoulessNet/Internal/RawYoulessUsageData.cs
+++ src/YoulessNet/YoulessNet/Internal/RawYoulessUsageData.cs
@@ -7,6 +7,7 @@
     /// <summary>
     /// Raw parsing helper struct for usage data of <see cref="YoulessUsageData"/>
     /// </summary>
+    [DataContract]
     [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1812:AvoidUninstantiatedInternalClasses",
         Justification = "Instantiated by SimpleJson deserializer")]
     internal class RawYoulessUsageData : YoulessUsageData, ITranslateable {


Silverlight must use partial methods (aka pseudo events) Work Item #1515

--- trunk/Solutions/CslaGenFork/CodeGen/CslaTemplateHelperCS.cs
+++ trunk/Solutions/CslaGenFork/CodeGen/CslaTemplateHelperCS.cs
@@ -847,7 +847,7 @@
             // show unconditionally, before everything else
             var commonNamespaces = new List<string>();
             commonNamespaces.AddRange(GetBaseCommonNamespaces(info, unit, cachedContextUtilitiesNamespace));
-            commonNamespaces.AddRange(GetCommonNamespaces(info));
+            commonNamespaces.AddRange(GetCommonNamespaces(info, cachedContextUtilitiesNamespace));

             // show only for Silverlight
             var silverlightNamespaces = new List<string>();
@@ -919,8 +919,7 @@
             return result;
         }

-        private List<string> GetBaseCommonNamespaces(CslaObjectInfo info, CslaGeneratorUnit unit,
-                                                     string contextUtilitiesnamespace)
+        private List<string> GetBaseCommonNamespaces(CslaObjectInfo info, CslaGeneratorUnit unit, string contextUtilitiesnamespace)
         {
             var result = new List<string>();

@@ -956,7 +955,7 @@
             return result;
         }

-        private List<string> GetCommonNamespaces(CslaObjectInfo info)
+        private List<string> GetCommonNamespaces(CslaObjectInfo info, string contextUtilitiesnamespace)
         {
             var result = new List<string>();

@@ -1073,6 +1072,10 @@
                         result.Add(parentInfo.ObjectNamespace);
             }

+            if (contextUtilitiesnamespace != string.Empty && HasSilverlightLocalDataPortalCreate(info))
+                result.Add(contextUtilitiesnamespace);
+
+
             if (result.Contains(string.Empty))
                 result.Remove(string.Empty);
             result.Sort(String.Compare);
@@ -1095,7 +1098,7 @@

             if (!unit.GenerationParams.TargetIsCsla4DAL || !unit.GenerationParams.GenerateDTO)
                 result.Add("Csla.Data");
-            if (contextUtilitiesnamespace != string.Empty)
+            if (contextUtilitiesnamespace != string.Empty && !HasSilverlightLocalDataPortalCreate(info))
                 result.Add(contextUtilitiesnamespace);

             if (result.Contains(string.Empty))
@@ -5703,7 +5706,9 @@
         public bool HasSilverlightLocalDataPortalCreate(CslaObjectInfo info)
         {
             var result = false;
-            if (CurrentUnit.GenerationParams.GenerateSilverlight4)
+            if (CurrentUnit.GenerationParams.GenerateSilverlight4 &&
+                IsObjectType(info.ObjectType) &&
+                !IsReadOnlyType(info.ObjectType))
             {
                 foreach (var crit in info.CriteriaObjects)
                 {


Restricted the UDI set up and tear down to only the UDI tests.

--- src/Umbraco.Tests/FrontEnd/UmbracoHelperTests.cs
+++ src/Umbraco.Tests/FrontEnd/UmbracoHelperTests.cs
@@ -16,33 +16,6 @@
     [TestFixture]
     public class UmbracoHelperTests
     {
-        [SetUp]
-        public void SetUp()
-        {
-            // fixme - bad in a unit test - but Udi has a static ctor that wants it?!
-            var container = new Mock<IServiceContainer>();
-            var globalSettings = SettingsForTests.GenerateMockGlobalSettings();
-
-            container
-                .Setup(x => x.GetInstance(typeof(TypeLoader)))
-                .Returns(new TypeLoader(
-                    NullCacheProvider.Instance,
-                    globalSettings,
-                    new ProfilingLogger(Mock.Of<ILogger>(), Mock.Of<IProfiler>())
-                    )
-                );
-
-            Current.Container = container.Object;
-
-            Udi.ResetUdiTypes();
-        }
-
-        [TearDown]
-        public void TearDown()
-        {
-            Current.Reset();
-        }
-
         [Test]
         public void Truncate_Simple()
         {
@@ -341,15 +314,11 @@
         }

         // ------- UDI Conversion Tests
-        /// <remarks>
-        /// This requires PluginManager.Current to be initialised before
-        /// running.
-        /// </remarks>
-        [Test]
-        public static void Converting_boxed_udi_to_a_udi_returns_original_udi_value()
-        {
-            // Arrange
-            Udi.ResetUdiTypes();
+        [Test]
+        public void Converting_boxed_udi_to_a_udi_returns_original_udi_value()
+        {
+            // Arrange
+            SetUpUdiTests();
             Udi sample = new GuidUdi(Constants.UdiEntityType.AnyGuid, Guid.NewGuid());

             // Act
@@ -359,19 +328,17 @@
                 );

             // Assert
+            TearDownUdiTests();
+
             Assert.IsTrue(success);
             Assert.That(result, Is.EqualTo(sample));
         }

-        /// <remarks>
-        /// This requires PluginManager.Current to be initialised before
-        /// running.
-        /// </remarks>
-        [Test]
-        public static void Converting_string_udi_to_a_udi_returns_original_udi_value()
-        {
-            // Arrange
-            Udi.ResetUdiTypes();
+        [Test]
+        public void Converting_string_udi_to_a_udi_returns_original_udi_value()
+        {
+            // Arrange
+            SetUpUdiTests();
             Udi sample = new GuidUdi(Constants.UdiEntityType.AnyGuid, Guid.NewGuid());

             // Act
@@ -381,42 +348,37 @@
                 );

             // Assert
+            TearDownUdiTests();
+
             Assert.IsTrue(success, "Conversion of UDI failed.");
             Assert.That(result, Is.EqualTo(sample));
         }

-        /// <remarks>
-        /// This requires PluginManager.Current to be initialised before
-        /// running.
-        /// </remarks>
-        [Test]
-        public static void Converting_hello_to_a_udi_returns_false()
-        {
-            // Arrange
-            Udi.ResetUdiTypes();
-            const string sample = "Hello";
+        [Test]
+        public void Converting_hello_to_a_udi_returns_false()
+        {
+            // Arrange
+            SetUpUdiTests();
+            const string SAMPLE = "Hello";

             // Act
             bool success = UmbracoHelper.ConvertIdObjectToUdi(
-                sample,
+                SAMPLE,
                 out Udi result
                 );

             // Assert
+            TearDownUdiTests();
+
             Assert.IsFalse(success);
             Assert.That(result, Is.Null);
         }

-        /// <remarks>
-        /// This requires PluginManager.Current to be initialised before
-        /// running.
-        /// </remarks>
-        [Test]
-        public static void Converting_unsupported_object_to_a_udi_returns_false()
-        {
-            // Arrange
-            Udi.ResetUdiTypes();
-
+        [Test]
+        public void Converting_unsupported_object_to_a_udi_returns_false()
+        {
+            // Arrange
+            SetUpUdiTests();
             var clearlyWillNotConvertToGuid = new StringBuilder(0);

             // Act
@@ -426,8 +388,32 @@
                 );

             // Assert
+            TearDownUdiTests();
+
             Assert.IsFalse(success);
             Assert.That(result, Is.Null);
         }
+
+        public void SetUpUdiTests()
+        {
+            // fixme - bad in a unit test - but Udi has a static ctor that wants it?!
+            var container = new Mock<IServiceContainer>();
+            var globalSettings = SettingsForTests.GenerateMockGlobalSettings();
+
+            container
+                .Setup(x => x.GetInstance(typeof(TypeLoader)))
+                .Returns(new TypeLoader(
+                    NullCacheProvider.Instance,
+                    globalSettings,
+                    new ProfilingLogger(Mock.Of<ILogger>(), Mock.Of<IProfiler>())
+                    )
+                );
+
+            Current.Container = container.Object;
+
+            Udi.ResetUdiTypes();
+        }
+
+        public void TearDownUdiTests() => Current.Reset();
     }
 }


Bugfix

Bugfix

--- src/Umbraco.Web/umbraco.presentation/template.cs
+++ src/Umbraco.Web/umbraco.presentation/template.cs
@@ -497,8 +497,12 @@
             var t = ApplicationContext.Current.ApplicationCache.GetCacheItem(
                string.Format("{0}{1}", CacheKeys.TemplateFrontEndCacheKey, tId), () =>
                {
-                   using (var templateData = SqlHelper.ExecuteReader("select nodeId, alias, master, text, design from cmsTemplate inner join umbracoNode node on node.id = cmsTemplate.nodeId where nodeId = @templateID", SqlHelper.CreateParameter("@templateID", templateID)))
-                   {
+                   using (var templateData = SqlHelper.ExecuteReader(@"select nodeId, alias, node.parentID as master, text, design
+from cmsTemplate
+inner join umbracoNode node on (node.id = cmsTemplate.nodeId)
+where nodeId = @templateID",
+                           SqlHelper.CreateParameter("@templateID", templateID)))
+                    {
                        if (templateData.Read())
                        {
                            // Get template master and replace content where the template


Actually fixed that formatting issue.

Actually fixed that formatting issue.

--- KVLib/KeyValue.cs
+++ KVLib/KeyValue.cs
@@ -178,8 +178,8 @@
         public string ToString(int indent)
         {
             if (children == null)
-            {
-                return string.Format("\"{0}\"\t\"{1}\"", Key, Value);
+            {
+                return string.Format("{0}\"{1}\"\t\"{2}\"",indent > 0 ? "\t" : "", Key, Value);
             }
             StringBuilder builder = new StringBuilder();
             for (int i = 0; i < indent; i++)
@@ -194,7 +194,7 @@
             builder.AppendLine("{");
             foreach (KeyValue child in Children)
             {
-                for (int i = 0; i < indent+1; i++)
+                for (int i = 0; i < indent; i++)
                 {
                     builder.Append("\t");
                 }


Converting bmp for open cv WIP

Converting bmp for open cv WIP

--- Basic/Test.xaml.cs
+++ Basic/Test.xaml.cs
@@ -2,6 +2,9 @@
 using Microsoft.Kinect;
 using System.Windows.Media;
 using System.Windows.Media.Imaging;
+using Emgu.CV;
+using Emgu.CV.Structure;
+using System;

 namespace Basic
 {
@@ -34,6 +37,8 @@
                 if (frame != null)
                 {
                     Photo.Source = ToBitmap(frame);
+                    Image<Bgr, Byte> imageForCV = (Image<Bgr, Byte>)ToImage(frame);
+
                 }
             }
         }
@@ -59,6 +64,29 @@
             return BitmapSource.Create(width, height, 96, 96, format, null, pixels, stride);
         }

+        public static Image<Bgra, byte> ToImage(this ColorFrame frame)
+        {
+            int width = frame.FrameDescription.Width;
+            int height = frame.FrameDescription.Height;
+            PixelFormat format = PixelFormats.Bgr32;
+
+            byte[] pixels = new byte[width * height * ((format.BitsPerPixel + 7) / 8)];
+
+            if (frame.RawColorImageFormat == ColorImageFormat.Bgra)
+            {
+                frame.CopyRawFrameDataToArray(pixels);
+            }
+            else
+            {
+                frame.CopyConvertedFrameDataToArray(pixels, ColorImageFormat.Bgra);
+            }
+
+            Image<Bgra, byte> img = new Image<Bgra, byte>(width, height);
+            img.Bytes = pixels;
+
+            return img;
+        }
+
     }
 }


Throwing ArgumentNullException

Throwing ArgumentNullException

--- BitPay/KeyUtils.cs
+++ BitPay/KeyUtils.cs
@@ -132,10 +132,11 @@

         public static byte[] hexToBytes(string hex)
         {
+            if (hex == null)
+                throw new ArgumentNullException("hex");
             if (hex.Length % 2 == 1)
-            {
-                throw new Exception("The binary key cannot have an odd number of digits");
-            }
+                throw new FormatException("The binary key cannot have an odd number of digits");
+
             byte[] arr = new byte[hex.Length >> 1];

             for (int i = 0; i < hex.Length >> 1; ++i)


extract test helper method

extract test helper method

--- ManyConsole.Tests/ConsoleModeCommandSpecs/Should_fail_strictly_on_error_when_running_noninteractive.cs
+++ ManyConsole.Tests/ConsoleModeCommandSpecs/Should_fail_strictly_on_error_when_running_noninteractive.cs
@@ -16,38 +16,17 @@
         {
             StatusEchoCommand.RunCount = 0;

-            var injectedInputStream = new MemoryStream();
-
-            var fakeConsoleWriter = new StringWriter();
-            var fakeConsoleReader = new StreamReader(injectedInputStream);
-
-            var consoleModeCommand = new ConsoleModeCommand(
-                () => new ConsoleCommand[] { new StatusEchoCommand()},
-                fakeConsoleWriter,
-                fakeConsoleReader);
-
             given("console input is coming from the user", delegate
             {
-                arrange(() => consoleModeCommand.RedirectionDetector = A.Fake<IConsoleRedirectionDetection>());
-                arrange(() => A.CallTo(() => consoleModeCommand.RedirectionDetector.IsInputRedirected()).Returns(false));
-
                 when("multiple commands run successfully", delegate
                 {
-                    arrange(delegate
+                    var result = arrange(RunConsoleModeCommand(new string[]
                     {
-                        var injectedInput = new StreamWriter(injectedInputStream);
-
-                        injectedInput.WriteLine("echo-status -s 0");
-                        injectedInput.WriteLine("echo-status -s 0");
-                        injectedInput.WriteLine("echo-status -s 0");
-                        injectedInput.WriteLine("x");
-                        injectedInput.Flush();
-
-                        injectedInputStream.Seek(0, SeekOrigin.Begin);
-                    });
-
-                    var result = arrange(() => ConsoleCommandDispatcher.DispatchCommand(
-                        new ConsoleCommand[] { consoleModeCommand }, new string[0], fakeConsoleWriter));
+                        "echo-status -s 0",
+                        "echo-status -s 0",
+                        "echo-status -s 0",
+                        "x",
+                    }, true));

                     then("the return code is 0", delegate
                     {
@@ -62,22 +41,15 @@

                 when("one of multiple commands fails", delegate
                 {
-                    arrange(delegate
+                    var arrangeAction = RunConsoleModeCommand(new string[]
                     {
-                        var injectedInput = new StreamWriter(injectedInputStream);
+                        "echo-status -s 0",
+                        "echo-status -s 2",
+                        "echo-status -s 0",
+                        "x",
+                    }, true);

-                        injectedInput.WriteLine("echo-status -s 0");
-                        injectedInput.WriteLine("echo-status -s 2");
-                        injectedInput.WriteLine("echo-status -s 0");
-                        injectedInput.WriteLine("x");
-                        injectedInput.Flush();
-
-                        injectedInputStream.Seek(0, SeekOrigin.Begin);
-                    });
-
-                    var result = arrange(() => ConsoleCommandDispatcher.DispatchCommand(
-                        new ConsoleCommand[] { consoleModeCommand }, new string[0], fakeConsoleWriter));
-
+                    var result = arrange(arrangeAction);

                     then("the return code is -1", delegate
                     {
@@ -93,24 +65,13 @@

             given("console input is not coming from the the user", delegate
             {
-                arrange(() => consoleModeCommand.RedirectionDetector = A.Fake<IConsoleRedirectionDetection>());
-                arrange(() => A.CallTo(() => consoleModeCommand.RedirectionDetector.IsInputRedirected()).Returns(true));
-
-                arrange(delegate
-                {
-                    var injectedInput = new StreamWriter(injectedInputStream);
-
-                    injectedInput.WriteLine("echo-status -s 0");
-                    injectedInput.WriteLine("echo-status -s 456");
-                    injectedInput.WriteLine("echo-status -s 0");
-                    injectedInput.WriteLine("x");
-                    injectedInput.Flush();
-
-                    injectedInputStream.Seek(0, SeekOrigin.Begin);
-                });
-
-                var result = arrange(() => ConsoleCommandDispatcher.DispatchCommand(
-                    new ConsoleCommand[] { consoleModeCommand }, new string[0], fakeConsoleWriter));
+                var result = arrange(RunConsoleModeCommand(new string[]
+                    {
+                        "echo-status -s 0",
+                        "echo-status -s 456",
+                        "echo-status -s 0",
+                        "x",
+                    }, false));

                 then("execution stops after that command", delegate()
                 {
@@ -122,6 +83,39 @@
                     expect(() => result == 456);
                 });
             });
+        }
+
+        Func<int> RunConsoleModeCommand(string[] lines, bool inputIsFromUser)
+        {
+            var injectedInputStream = new MemoryStream();
+
+            var fakeConsoleWriter = new StringWriter();
+            var fakeConsoleReader = new StreamReader(injectedInputStream);
+
+            var consoleModeCommand = new ConsoleModeCommand(
+                () => new ConsoleCommand[] {new StatusEchoCommand()},
+                fakeConsoleWriter,
+                fakeConsoleReader);
+
+            arrange(delegate
+            {
+                var injectedInput = new StreamWriter(injectedInputStream);
+
+                foreach (var line in lines)
+                    injectedInput.WriteLine(line);
+                injectedInput.Flush();
+
+                injectedInputStream.Seek(0, SeekOrigin.Begin);
+            });
+
+            Func<int> arrangeAction =
+                () =>
+                ConsoleCommandDispatcher.DispatchCommand(new ConsoleCommand[] {consoleModeCommand}, new string[0],
+                                                         fakeConsoleWriter);
+
+            arrange(() => consoleModeCommand.RedirectionDetector = A.Fake<IConsoleRedirectionDetection>());
+            arrange(() => A.CallTo(() => consoleModeCommand.RedirectionDetector.IsInputRedirected()).Returns(!inputIsFromUser));
+            return arrangeAction;
         }

         public class StatusEchoCommand : ConsoleCommand


Update PgSql

Update PgSql

--- Src/Asp.NetCore2/SqlSeverTest/SqlSugar/Realization/PostgreSQL/DbMaintenance/PostgreSQLDbMaintenance.cs
+++ Src/Asp.NetCore2/SqlSeverTest/SqlSugar/Realization/PostgreSQL/DbMaintenance/PostgreSQLDbMaintenance.cs
@@ -194,9 +194,9 @@

         protected override string IsAnyColumnRemarkSql => throw new NotSupportedException();

-        protected override string AddTableRemarkSql => "comment on {0} user is '{1}'";
-
-        protected override string DeleteTableRemarkSql => "comment on {0} user is ''";
+        protected override string AddTableRemarkSql => "comment on table {0} is '{1}'";
+
+        protected override string DeleteTableRemarkSql => "comment on table {0} is ''";

         protected override string IsAnyTableRemarkSql => throw new NotSupportedException();
         #endregion


Add whitespace before C# exception in log

--- renderdocui/Code/AppMain.cs
+++ renderdocui/Code/AppMain.cs
@@ -136,6 +136,7 @@
         {
             // we log out this string, which is matched against in renderdoccmd to pull out the callstack
             // from the log even in the case where the user chooses not to submit the error log
+            StaticExports.LogText("\n\n");
             StaticExports.LogText("--- Begin C# Exception Data ---");
             if (ex != null)
             {


added save to add/update button

added save to add/update button

--- idseefeld.de.imagecropper/imagecropper/PrevalueEditor.cs
+++ idseefeld.de.imagecropper/imagecropper/PrevalueEditor.cs
@@ -260,6 +260,8 @@
 			txtTargetWidth.Text = "";
 			txtTargetHeight.Text = "";
 			chkKeepAspect.Checked = true;
+
+			Save();
 		}

 		public Control Editor


Fixed bug with capabilities

Fixed bug with capabilities

--- LifxHttp/Light.cs
+++ LifxHttp/Light.cs
@@ -95,19 +95,22 @@
         [JsonProperty("product_name")]
         public string ProductName { get; private set; }

-        [JsonProperty]
-        private Dictionary<string, bool> capabilties = new Dictionary<string, bool>();
+        [JsonProperty("capabilities")]
+        private Dictionary<string, bool> capabilities;
         private LifxColor.HSBK color;

         public IEnumerable<string> Capabilities
         {
             get
             {
-                foreach (var entry in capabilties)
+                if (capabilities != null)
                 {
-                    if (entry.Value)
+                    foreach (var entry in capabilities)
                     {
-                        yield return entry.Key;
+                        if (entry.Value)
+                        {
+                            yield return entry.Key;
+                        }
                     }
                 }
             }
@@ -115,7 +118,7 @@

         public bool HasCapability(string capabilitity)
         {
-            return capabilties.ContainsKey(capabilitity) && capabilties[capabilitity];
+            return capabilities != null && capabilities.ContainsKey(capabilitity) && capabilities[capabilitity];
         }

         public async Task<ApiResult> TogglePower()


AggregateRepository now supports asynchronous OnEvent/SnapshotSaved method calls...

--- src/iSynaptic.Core/Modeling/Domain/AggregateRepository.cs
+++ src/iSynaptic.Core/Modeling/Domain/AggregateRepository.cs
@@ -34,6 +34,8 @@
         where TAggregate : class, IAggregate<TIdentifier>
         where TIdentifier : IEquatable<TIdentifier>
     {
+        private static readonly Task _completedTask = Task.FromResult(true);
+
         ITask<TAggregate> IAggregateRepositoryQueries<TAggregate, TIdentifier>.Get(TIdentifier id, Int32 maxVersion)
         {
             return Get(id, maxVersion).ToCovariantTask();
@@ -106,7 +108,7 @@
             }

             ag.CommitEvents();
-            OnEventStreamSaved(aggregateType, aggregate.Id, events);
+            await OnEventStreamSaved(aggregateType, aggregate.Id, events);
         }

         public async Task SaveSnapshot(TAggregate aggregate)
@@ -126,7 +128,7 @@
             var data = new AggregateSnapshotSaveFrame<TIdentifier>(aggregateType, aggregate.Id, isNew, snapshot);
             await SaveSnapshot(data);

-            OnSnapshotSaved(aggregateType, snapshot);
+            await OnSnapshotSaved(aggregateType, snapshot);
         }

         private IAggregateInternal<TIdentifier> AsInternal(TAggregate aggregate)
@@ -136,8 +138,8 @@
             return ag;
         }

-        protected virtual void OnEventStreamSaved(Type aggregateType, TIdentifier id, IEnumerable<IAggregateEvent<TIdentifier>> events) { }
-        protected virtual void OnSnapshotSaved(Type aggregateType, IAggregateSnapshot<TIdentifier> snapshot) { }
+        protected virtual Task OnEventStreamSaved(Type aggregateType, TIdentifier id, IEnumerable<IAggregateEvent<TIdentifier>> events) { return _completedTask; }
+        protected virtual Task OnSnapshotSaved(Type aggregateType, IAggregateSnapshot<TIdentifier> snapshot) { return _completedTask; }

         public async Task<AggregateMemento<TIdentifier>> GetMemento(TIdentifier id, Int32 maxVersion)
         {


DB valid from 2014 on

DB valid from 2014 on

--- AVF.MemberManagement.ReportsBusinessLogic/DatabaseWrapper.cs
+++ AVF.MemberManagement.ReportsBusinessLogic/DatabaseWrapper.cs
@@ -85,7 +85,7 @@
         public DateTime GetStartValidData()
         {
             string strStartValidData = P_settings.Single(s => s.Id == "DateValidData").Value;
-            return new DateTime(2014, 1, 1); // DateTime.Parse(strStartValidData);
+            return DateTime.Parse(strStartValidData);
         }

         public string WeekDay(int id)


Update LookAtCamera position offset to use the vector between obj and head pos, not camera forward

--- Assets/MRTK/SDK/Features/Utilities/Solvers/HandConstraint.cs
+++ Assets/MRTK/SDK/Features/Utilities/Solvers/HandConstraint.cs
@@ -438,6 +438,7 @@
         private static Ray CalculateProjectedSafeZoneRay(Vector3 origin, Transform targetTransform, IMixedRealityController hand, SolverSafeZone handSafeZone, SolverOffsetBehavior offsetBehavior)
         {
             Vector3 direction;
+            Vector3 lookAtCamera = targetTransform.transform.position - CameraCache.Main.transform.position;

             switch (handSafeZone)
             {
@@ -450,7 +451,7 @@
                         }
                         else
                         {
-                            direction = Vector3.Cross(CameraCache.Main.transform.forward, Vector3.up);
+                            direction = Vector3.Cross(lookAtCamera, Vector3.up);
                             direction = IsPalmFacingCamera(hand) ? direction : -direction;
                         }

@@ -470,7 +471,7 @@
                         }
                         else
                         {
-                            direction = Vector3.Cross(CameraCache.Main.transform.forward, Vector3.up);
+                            direction = Vector3.Cross(lookAtCamera, Vector3.up);
                             direction = IsPalmFacingCamera(hand) ? direction : -direction;
                         }


Try out tests

Try out tests

--- Assets/MRTK/Tests/EditModeTests/Editor/ToolboxWindowTests.cs
+++ Assets/MRTK/Tests/EditModeTests/Editor/ToolboxWindowTests.cs
@@ -4,16 +4,18 @@
 using Microsoft.MixedReality.Toolkit.Editor;
 using NUnit.Framework;
 using System.Collections;
+using UnityEditor;
 using UnityEngine.TestTools;
 using static Microsoft.MixedReality.Toolkit.Editor.MixedRealityToolboxWindow;

-namespace Microsoft.MixedReality.Toolkit.Tests.EditMode.Editor
+namespace Microsoft.MixedReality.Toolkit.Tests.EditModeTests.Editor
 {
     /// <summary>
     /// Set of tests to validate MRTK Toolbox Editor window
     /// </summary>
     public class ToolboxWindowTests
     {
+#if UNITY_EDITOR
         /// <summary>
         /// Tests that the MixedRealityToolboxWindow can load without exception and that none of
         /// it's internal item contents are null or invalid
@@ -40,6 +42,34 @@

             MixedRealityToolboxWindow.HideWindow();
         }
+#endif
+
+        [UnityTest]
+        public IEnumerator TestToolboxWindow2()
+        {
+            if (EditorApplication.isPlayingOrWillChangePlaymode)
+            {
+
+                MixedRealityToolboxWindow.ShowWindow();
+
+                var window = MixedRealityToolboxWindow.GetWindow<MixedRealityToolboxWindow>();
+
+                yield return WaitForWindowLoad();
+
+                Assert.IsNotNull(window.toolBoxCollection);
+
+                foreach (var category in window.ToolboxPrefabs)
+                {
+                    Assert.IsFalse(string.IsNullOrEmpty(category.CategoryName));
+                    foreach (var item in category.Items)
+                    {
+                        ValidateToolboxItem(item);
+                    }
+                }
+
+                MixedRealityToolboxWindow.HideWindow();
+            }
+        }

         private static IEnumerator WaitForWindowLoad()
         {


Fix #4

Fix #4

--- Beebotte.API.Client.Net/Beebotte.API.Client.Net/Connector.cs
+++ Beebotte.API.Client.Net/Beebotte.API.Client.Net/Connector.cs
@@ -77,7 +77,7 @@
                     var subs = from s in subscriptions
                                where
                                    String.Equals(s.ChannelInternalName, receivedMessage.channel, StringComparison.CurrentCultureIgnoreCase) &&
-                                   (String.Equals(s.Resource, receivedMessage.resource, StringComparison.CurrentCultureIgnoreCase) || receivedMessage.resource.Equals("*"))
+                                   (String.Equals(s.Resource, receivedMessage.resource, StringComparison.CurrentCultureIgnoreCase) || s.Resource.Equals("*"))
                                select s;
                     foreach (var subsription in subs)
                     {


ConfigureAwait

ConfigureAwait

--- async-dolls/1-Async/Script.cs
+++ async-dolls/1-Async/Script.cs
@@ -133,7 +133,7 @@
                             int nr = Interlocked.Increment(ref taskNumber);

                             Console.WriteLine("Kick off " + nr + " " + Thread.CurrentThread.ManagedThreadId);
-                            await LibraryCallWhichIsNotTrulyAsync();
+                            await LibraryCallWhichIsNotTrulyAsync().ConfigureAwait(false);
                             Console.WriteLine(" back " + nr + " " + Thread.CurrentThread.ManagedThreadId);

                             semaphore.Release();


add a note for very low-thread cpus

add a note for very low-thread cpus

--- CompatBot/Utils/ResultFormatters/LogParserResultFormatter.cs
+++ CompatBot/Utils/ResultFormatters/LogParserResultFormatter.cs
@@ -527,6 +527,8 @@
                         notes.Add("⚠ This CPU is too old and/or too weak for PS3 emulation");
                 }
             }
+            if (int.TryParse(items["thread_count"], out var threadCount) && threadCount < 4)
+                notes.Add($"❌ This CPU only has {threadCount} hardware thread{(threadCount == 1 ? "" : "s")} enabled");

             var supportedGpu = true;
             Version oglVersion = null;


Add color to star rating and star sprite icon

--- osu.Game/Beatmaps/Drawables/DifficultyIcon.cs
+++ osu.Game/Beatmaps/Drawables/DifficultyIcon.cs
@@ -37,7 +37,7 @@

         public string TooltipText { get; set; }

-        public ITooltip GetCustomTooltip() => new DifficultyIconTooltip();
+        public ITooltip GetCustomTooltip() => new DifficultyIconTooltip(AccentColour);

         public class DifficultyIconTooltip : VisibilityContainer, ITooltip
         {
@@ -46,7 +46,7 @@

             public string TooltipText { get; set; }

-            public DifficultyIconTooltip()
+            public DifficultyIconTooltip(Color4 accentColour)
             {
                 AutoSizeAxes = Axes.Both;
                 Masking = true;
@@ -84,6 +84,7 @@
                                         Anchor = Anchor.Centre,
                                         Origin = Anchor.Centre,
                                         Font = OsuFont.GetFont(size: 16, weight: FontWeight.Regular),
+                                        Colour = accentColour
                                     },
                                     new SpriteIcon
                                     {
@@ -92,7 +93,7 @@
                                         Margin = new MarginPadding { Left = 4 },
                                         Icon = FontAwesome.Solid.Star,
                                         Size = new Vector2(12),
-                                        Colour = Color4.White,
+                                        Colour = accentColour,
                                     },
                                 }
                             }


Highlight major changes in changelog overlay

--- osu.Game/Overlays/Changelog/ChangelogBuild.cs
+++ osu.Game/Overlays/Changelog/ChangelogBuild.cs
@@ -69,34 +69,69 @@
                         Margin = new MarginPadding { Vertical = 5 },
                     };

+                    var entryColor = entry.Major != null && (bool)entry.Major ? OsuColour.FromHex("#fd5") : Color4.White;
+
                     title.AddIcon(FontAwesome.Solid.Check, t =>
                     {
                         t.Font = fontSmall;
+                        t.Colour = entryColor;
                         t.Padding = new MarginPadding { Left = -17, Right = 5 };
                     });

-                    title.AddText(entry.Title, t => { t.Font = fontLarge; });
+                    title.AddText(entry.Title, t =>
+                    {
+                        t.Font = fontLarge;
+                        t.Colour = entryColor;
+                    });

                     if (!string.IsNullOrEmpty(entry.Repository))
                     {
-                        title.AddText(" (", t => t.Font = fontLarge);
+                        title.AddText(" (", t =>
+                        {
+                            t.Font = fontLarge;
+                            t.Colour = entryColor;
+                        });
                         title.AddLink($"{entry.Repository.Replace("ppy/", "")}#{entry.GithubPullRequestId}", entry.GithubUrl, Online.Chat.LinkAction.External,
-                            creationParameters: t => { t.Font = fontLarge; });
-                        title.AddText(")", t => t.Font = fontLarge);
+                            creationParameters: t =>
+                            {
+                                t.Font = fontLarge;
+                                t.Colour = entryColor;
+                            });
+                        title.AddText(")", t =>
+                        {
+                            t.Font = fontLarge;
+                            t.Colour = entryColor;
+                        });
                     }

-                    title.AddText(" by ", t => t.Font = fontMedium);
+                    title.AddText(" by ", t =>
+                    {
+                        t.Font = fontMedium;
+                        t.Colour = entryColor;
+                    });

                     if (entry.GithubUser.UserId != null)
                         title.AddUserLink(new User
                         {
                             Username = entry.GithubUser.OsuUsername,
                             Id = entry.GithubUser.UserId.Value
-                        }, t => t.Font = fontMedium);
+                        }, t =>
+                        {
+                            t.Font = fontMedium;
+                            t.Colour = entryColor;
+                        });
                     else if (entry.GithubUser.GithubUrl != null)
-                        title.AddLink(entry.GithubUser.DisplayName, entry.GithubUser.GithubUrl, Online.Chat.LinkAction.External, null, null, t => t.Font = fontMedium);
+                        title.AddLink(entry.GithubUser.DisplayName, entry.GithubUser.GithubUrl, Online.Chat.LinkAction.External, null, null, t =>
+                        {
+                            t.Font = fontMedium;
+                            t.Colour = entryColor;
+                        });
                     else
-                        title.AddText(entry.GithubUser.DisplayName, t => t.Font = fontSmall);
+                        title.AddText(entry.GithubUser.DisplayName, t =>
+                        {
+                            t.Font = fontSmall;
+                            t.Colour = entryColor;
+                        });

                     ChangelogEntries.Add(title);


Use linq instead of a temporary sorted list

--- osu.Game/Overlays/Changelog/ChangelogBuild.cs
+++ osu.Game/Overlays/Changelog/ChangelogBuild.cs
@@ -1,4 +1,4 @@
-// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
+// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
 // See the LICENCE file in the repository root for full licence text.

 using osu.Framework.Graphics;
@@ -8,7 +8,7 @@
 using osu.Game.Graphics.Containers;
 using osu.Game.Online.API.Requests.Responses;
 using System;
-using System.Collections.Generic;
+using System.Linq;
 using System.Text.RegularExpressions;
 using osu.Game.Graphics.Sprites;
 using osu.Game.Users;
@@ -44,30 +44,20 @@
                 },
             };

-            var categories = new SortedDictionary<string, List<APIChangelogEntry>>();
-
-            // sort entries by category
-            foreach (APIChangelogEntry entry in build.ChangelogEntries)
-            {
-                if (!categories.ContainsKey(entry.Category))
-                    categories.Add(entry.Category, new List<APIChangelogEntry> { entry });
-                else
-                    categories[entry.Category].Add(entry);
-            }
-
-            foreach (KeyValuePair<string, List<APIChangelogEntry>> category in categories)
+            foreach (var categoryEntries in build.ChangelogEntries.GroupBy(b => b.Category).OrderBy(c => c.Key))
             {
                 ChangelogEntries.Add(new OsuSpriteText
                 {
-                    Text = category.Key,
+                    Text = categoryEntries.Key,
                     Font = OsuFont.GetFont(weight: FontWeight.Bold, size: 24),
                     Margin = new MarginPadding { Top = 35, Bottom = 15 },
                 });

-                foreach (APIChangelogEntry entry in category.Value)
+                var fontLarge = OsuFont.GetFont(size: 18);
                 var fontMedium = OsuFont.GetFont(size: 14);
                 var fontSmall = OsuFont.GetFont(size: 12);

+                foreach (APIChangelogEntry entry in categoryEntries)
                 {
                     LinkFlowContainer title = new LinkFlowContainer
                     {


Use correct local variable

Use correct local variable

Co-Authored-By: peppy <1db828bcd41de75377dce59825af73ae7fca5651@ppy.sh>

--- osu.Game/Tests/Beatmaps/TestWorkingBeatmap.cs
+++ osu.Game/Tests/Beatmaps/TestWorkingBeatmap.cs
@@ -117,7 +117,7 @@
                         offset -= refTime;
                     }

-                    lastReferenceTime = referenceClock.CurrentTime;
+                    lastReferenceTime = refTime;
                 }

                 clock.CurrentTime = Math.Min((lastReferenceTime ?? 0) + offset, Length);


enhance Abstractions.WindowsApi.pInvokes.GetSessionContext

--- pGina/src/Abstractions/WindowsApi/pInvokes.cs
+++ pGina/src/Abstractions/WindowsApi/pInvokes.cs
@@ -1390,80 +1390,141 @@
         {
             List<string> ret = new List<string>();

+            Dictionary<int, List<string>> contextALL = GetSessionContext();
+            foreach (KeyValuePair<int, List<string>> pair in contextALL)
+            {
+                if (pair.Key == sessionID || sessionID == -1)
+                {
+                    foreach (string user in pair.Value)
+                    {
+                        if (!ret.Any(s => s.Equals(user, StringComparison.CurrentCultureIgnoreCase)))
+                        {
+                            ret.Add(user);
+                        }
+                    }
+                }
+            }
+
+            return ret;
+        }
+
+        /// <summary>
+        /// return username based on context in which a program is running.
+        /// a program running as administrator will add administrator to the list
+        /// session ID -1 retuns all sessions instead of a specific one
+        /// </summary>
+        /// <param name="sessionID">the seesion ID or -1 for all sessions</param>
+        /// <param name="contextALL">a GetSessionContext() Directory</param>
+        /// <returns>is a lower username like administrator</returns>
+        public static List<string> GetSessionContextParser(int sessionID, Dictionary<int, List<string>> contextALL)
+        {
+            List<string> ret = new List<string>();
+
+            foreach (KeyValuePair<int, List<string>> pair in contextALL)
+            {
+                if (pair.Key == sessionID || sessionID == -1)
+                {
+                    foreach (string user in pair.Value)
+                    {
+                        if (!ret.Any(s => s.Equals(user, StringComparison.CurrentCultureIgnoreCase)))
+                        {
+                            ret.Add(user);
+                        }
+                    }
+                }
+            }
+
+            return ret;
+        }
+
+        /// <summary>
+        /// returns a Dictionary of SessionID Keys and a List of usernames based on context in which a program is running.
+        /// a program running as administrator will add administrator to the list
+        /// </summary>
+        /// <returns>is a lower username like administrator</returns>
+        public static Dictionary<int, List<string>> GetSessionContext()
+        {
+            Dictionary<int, List<string>> ret = new Dictionary<int, List<string>>();
+
             foreach (Process process in Process.GetProcesses())
             {
                 try { var test = process.Handle; }
                 catch { continue; }
-                if (process.SessionId == sessionID || sessionID == -1)
+
+                //Console.WriteLine("process:{0}", process.ProcessName);
+                IntPtr tokenHandle;
+                // Get the Process Token
+                if (!SafeNativeMethods.OpenProcessToken(process.Handle, SafeNativeMethods.TokenAccessRights.TOKEN_READ, out tokenHandle))
                 {
-                    //Console.WriteLine("process:{0}", process.ProcessName);
-                    IntPtr tokenHandle;
-                    // Get the Process Token
-                    if (!SafeNativeMethods.OpenProcessToken(process.Handle, SafeNativeMethods.TokenAccessRights.TOKEN_READ, out tokenHandle))
+                    LibraryLogging.Error("OpenProcessToken error:{0}", LastError());
+                    return ret;
+                }
+
+                int TokenInfLength = 0;
+                if (!SafeNativeMethods.GetTokenInformation(tokenHandle, SafeNativeMethods.TOKEN_INFORMATION_CLASS.TokenUser, IntPtr.Zero, TokenInfLength, out TokenInfLength))
+                {
+                    int error = Marshal.GetLastWin32Error();
+                    if (error != 122 /*ERROR_INSUFFICIENT_BUFFER*/)
                     {
-                        LibraryLogging.Error("OpenProcessToken error:{0}", LastError());
-                        return ret;
+                        LibraryLogging.Error("GetTokenInformation error:{0} {1}", error, LastError());
                     }
-
-                    int TokenInfLength = 0;
-                    if (!SafeNativeMethods.GetTokenInformation(tokenHandle, SafeNativeMethods.TOKEN_INFORMATION_CLASS.TokenUser, IntPtr.Zero, TokenInfLength, out TokenInfLength))
+                    else
                     {
-                        int error = Marshal.GetLastWin32Error();
-                        if (error != 122 /*ERROR_INSUFFICIENT_BUFFER*/)
+                        IntPtr TokenInformation = Marshal.AllocHGlobal(TokenInfLength);
+                        if (!SafeNativeMethods.GetTokenInformation(tokenHandle, SafeNativeMethods.TOKEN_INFORMATION_CLASS.TokenUser, TokenInformation, TokenInfLength, out TokenInfLength))
                         {
-                            LibraryLogging.Error("GetTokenInformation error:{0} {1}", error, LastError());
+                            LibraryLogging.Error("GetTokenInformation error:{0}", LastError());
                         }
                         else
                         {
-                            IntPtr TokenInformation = Marshal.AllocHGlobal(TokenInfLength);
-                            if (!SafeNativeMethods.GetTokenInformation(tokenHandle, SafeNativeMethods.TOKEN_INFORMATION_CLASS.TokenUser, TokenInformation, TokenInfLength, out TokenInfLength))
+                            SafeNativeMethods.TOKEN_USER TokenUser = (SafeNativeMethods.TOKEN_USER)Marshal.PtrToStructure(TokenInformation, typeof(SafeNativeMethods.TOKEN_USER));
+
+                            StringBuilder name = new StringBuilder();
+                            uint cchName = (uint)name.Capacity;
+                            StringBuilder referencedDomainName = new StringBuilder();
+                            uint cchReferencedDomainName = (uint)referencedDomainName.Capacity;
+                            SafeNativeMethods.SID_NAME_USE sidUse;
+
+
+                            bool WinAPI = SafeNativeMethods.LookupAccountSid(null, TokenUser.User.Sid, name, ref cchName, referencedDomainName, ref cchReferencedDomainName, out sidUse);
+                            if (!WinAPI)
                             {
-                                LibraryLogging.Error("GetTokenInformation error:{0}", LastError());
-                            }
-                            else
-                            {
-                                SafeNativeMethods.TOKEN_USER TokenUser = (SafeNativeMethods.TOKEN_USER)Marshal.PtrToStructure(TokenInformation, typeof(SafeNativeMethods.TOKEN_USER));
-
-                                StringBuilder name = new StringBuilder();
-                                uint cchName = (uint)name.Capacity;
-                                StringBuilder referencedDomainName = new StringBuilder();
-                                uint cchReferencedDomainName = (uint)referencedDomainName.Capacity;
-                                SafeNativeMethods.SID_NAME_USE sidUse;
-
-
-                                bool WinAPI = SafeNativeMethods.LookupAccountSid(null, TokenUser.User.Sid, name, ref cchName, referencedDomainName, ref cchReferencedDomainName, out sidUse);
-                                if (!WinAPI)
+                                error = Marshal.GetLastWin32Error();
+                                if (error == 122 /*ERROR_INSUFFICIENT_BUFFER*/)
                                 {
-                                    error = Marshal.GetLastWin32Error();
-                                    if (error == 122 /*ERROR_INSUFFICIENT_BUFFER*/)
-                                    {
-                                        name.EnsureCapacity((int)cchName);
-                                        referencedDomainName.EnsureCapacity((int)cchReferencedDomainName);
-                                        WinAPI = SafeNativeMethods.LookupAccountSid(null, TokenUser.User.Sid, name, ref cchName, referencedDomainName, ref cchReferencedDomainName, out sidUse);
-                                        if (!WinAPI)
-                                        {
-                                            LibraryLogging.Error("LookupAccountSid error:{0}", LastError());
-                                        }
-                                    }
-                                    else
+                                    name.EnsureCapacity((int)cchName);
+                                    referencedDomainName.EnsureCapacity((int)cchReferencedDomainName);
+                                    WinAPI = SafeNativeMethods.LookupAccountSid(null, TokenUser.User.Sid, name, ref cchName, referencedDomainName, ref cchReferencedDomainName, out sidUse);
+                                    if (!WinAPI)
                                     {
                                         LibraryLogging.Error("LookupAccountSid error:{0}", LastError());
                                     }
                                 }
-                                if (WinAPI)
+                                else
                                 {
-                                    LibraryLogging.Info("Found process:{0} in session:{1} account:{2}", process.ProcessName, process.SessionId, name.ToString());
-                                    if (!ret.Contains(name.ToString()))
+                                    LibraryLogging.Error("LookupAccountSid error:{0}", LastError());
+                                }
+                            }
+                            if (WinAPI)
+                            {
+                                LibraryLogging.Info("Found process:{0} in session:{1} account:{2}", process.ProcessName, process.SessionId, name.ToString());
+                                if (!ret.ContainsKey(process.SessionId))
+                                {
+                                    ret.Add(process.SessionId, new List<string>() { name.ToString() });
+                                }
+                                else
+                                {
+                                    if (!ret[process.SessionId].Contains(name.ToString()))
                                     {
-                                        ret.Add(name.ToString());
+                                        ret[process.SessionId].Add(name.ToString());
                                     }
                                 }
                             }
-                            Marshal.FreeHGlobal(TokenInformation);
                         }
+                        Marshal.FreeHGlobal(TokenInformation);
                     }
-                    SafeNativeMethods.CloseHandle(tokenHandle);
                 }
+                SafeNativeMethods.CloseHandle(tokenHandle);
             }

             return ret;


refactor: remove unnecessary type casting.

--- test/ExperimentUnitTest/FirstClassCommandTest.cs
+++ test/ExperimentUnitTest/FirstClassCommandTest.cs
@@ -30,7 +30,7 @@
             Assert.Throws<ArgumentNullException>(
                 () => new FirstClassCommand(
                     Reflector.Wrap((MethodInfo)MethodBase.GetCurrentMethod()),
-                    (Delegate)null,
+                    null,
                     new object[0]));
         }


move default target definition to the correct place

--- targets/Program.cs
+++ targets/Program.cs
@@ -8,8 +8,6 @@
 {
     public static Task Main(string[] args)
     {
-        Target("default", DependsOn("pack", "test"));
-
         Target("build", () => RunAsync("dotnet", "build --configuration Release --nologo --verbosity quiet"));

         Target(
@@ -26,6 +24,8 @@
             DependsOn("build"),
             () => RunAsync("dotnet", "test --configuration Release --no-build --nologo"));

+        Target("default", DependsOn("pack", "test"));
+
         return RunTargetsAndExitAsync(args, ex => ex is NonZeroExitCodeException);
     }
 }


enlarge timeout value to 100 seconds

enlarge timeout value to 100 seconds

--- test/Sleet.AmazonS3.Tests/AmazonS3TestContext.cs
+++ test/Sleet.AmazonS3.Tests/AmazonS3TestContext.cs
@@ -29,7 +29,7 @@
             var region = Environment.GetEnvironmentVariable(EnvDefaultRegion) ?? "us-east-1";
             AmazonS3Config config = new AmazonS3Config()
                 {
-                    Timeout = TimeSpan.FromSeconds(10),
+                    Timeout = TimeSpan.FromSeconds(100),
                     RegionEndpoint = RegionEndpoint.GetBySystemName(region)
                 };
             Client = new AmazonS3Client(accessKeyId, secretAccessKey, config);


changing how offenders are sent

changing how offenders are sent

--- java-janitor/JavaJanitor/Controllers/CarafeController.cs
+++ java-janitor/JavaJanitor/Controllers/CarafeController.cs
@@ -55,8 +55,8 @@
         }

         [HttpPost]
-        [Route("carafe/offender/image")]
-        public HttpResponseMessage AddOffenderImage([FromBody] string imageUrl)
+        [Route("carafe/offender/image/{url}")]
+        public HttpResponseMessage AddOffenderImage(string url)
         {
             DateTime now = DateTime.Now;
             Image image = new Image();
@@ -80,8 +80,8 @@
         }

         [HttpPost]
-        [Route("carafe/offender/name")]
-        public HttpResponseMessage SetOffenderName([FromBody] string name)
+        [Route("carafe/offender/name/{name}")]
+        public HttpResponseMessage SetOffenderName(string name)
         {
             Carafe.Name = name;
             Carafe.LastUpdated = DateTime.Now;


Add missing annotations dependency.

Add missing annotations dependency.

--- packages.cake
+++ packages.cake
@@ -120,6 +120,7 @@
         var SharpDXDirect3D11Version = packageVersions["SharpDX.Direct3D11"].FirstOrDefault().Item1;
         var SharpDXDirect3D9Version = packageVersions["SharpDX.Direct3D9"].FirstOrDefault().Item1;
         var SharpDXDXGIVersion = packageVersions["SharpDX.DXGI"].FirstOrDefault().Item1;
+        var SystemComponentModelAnnotationsVersion = packageVersions["System.ComponentModel.Annotations"].FirstOrDefault().Item1;

         context.Information("Package: Serilog, version: {0}", SerilogVersion);
         context.Information("Package: Sprache, version: {0}", SpracheVersion);
@@ -238,6 +239,7 @@
                     new NuSpecDependency() { Id = "Sprache", Version = SpracheVersion },
                     new NuSpecDependency() { Id = "System.Reactive", Version = SystemReactiveVersion },
                     new NuSpecDependency() { Id = "Avalonia.Remote.Protocol", Version = parameters.Version },
+                    new NuSpecDependency() { Id = "System.ComponentModel.Annotations", Version = SystemComponentModelAnnotationsVersion },
                     //.NET Core
                     new NuSpecDependency() { Id = "System.Threading.ThreadPool", TargetFramework = "netcoreapp2.0", Version = "4.3.0" },
                     new NuSpecDependency() { Id = "Microsoft.Extensions.DependencyModel", TargetFramework = "netcoreapp2.0", Version = "1.1.0" },


Implemented TestClient's IMCommand using the new Avatars.RequestAvatarNameSearch()

git-svn-id: baf6e02d125cf6f9bfcfe153b2eb83d6e1f5ace6@760 52acb1d6-8a22-11de-b505-999d5b087335

--- libsecondlife-cs/examples/TestClient/Commands/IMCommand.cs
+++ libsecondlife-cs/examples/TestClient/Commands/IMCommand.cs
@@ -1,5 +1,6 @@
 using System;
 using System.Collections.Generic;
+using System.Threading;
 using libsecondlife;
 using libsecondlife.Packets;

@@ -8,12 +9,16 @@
     public class ImCommand : Command
     {
         SecondLife Client;
-        bool DirLookupComplete = false;
+        string ToAvatarName = String.Empty;
+        ManualResetEvent NameSearchEvent = new ManualResetEvent(false);
+        Dictionary<string, LLUUID> Name2Key = new Dictionary<string, LLUUID>();

         public ImCommand(TestClient testClient)
         {
             TestClient = testClient;
             Client = (SecondLife)TestClient;
+
+            Client.Avatars.OnAvatarNameSearch += new AvatarManager.AvatarNameSearchCallback(Avatars_OnAvatarNameSearch);

             Name = "im";
             Description = "Instant message someone. Usage: im [firstname] [lastname] [message]";
@@ -21,65 +26,50 @@

         public override string Execute(string[] args, LLUUID fromAgentID)
         {
-            return "FIXME";
-            // How do we register the callback only once for each client?
-
             if (args.Length < 3)
                 return "Usage: im [firstname] [lastname] [message]";

-            string toAgentName = args[0] + " " + args[1];
+            ToAvatarName = args[0] + " " + args[1];

+            // Build the message
             string message = String.Empty;
             for (int ct = 2; ct < args.Length; ct++)
                 message += args[ct] + " ";
             message = message.TrimEnd();
             if (message.Length > 1023) message = message.Remove(1023);

-            if (!TestClient.SharedValues.ContainsKey("name2key"))
+            if (!Name2Key.ContainsKey(ToAvatarName.ToLower()))
             {
-                // Initialize the shared name2key dictionary
-                TestClient.SharedValues["name2key"] = new Dictionary<string, LLUUID>();
+                // Send the Query
+                Client.Avatars.RequestAvatarNameSearch(ToAvatarName, LLUUID.Random());
+
+                NameSearchEvent.WaitOne(6000, false);
             }

-            Dictionary<string, LLUUID> name2key = (Dictionary<string, LLUUID>)TestClient.SharedValues["name2key"];
+            if (Name2Key.ContainsKey(ToAvatarName.ToLower()))
+            {
+                LLUUID id = Name2Key[ToAvatarName.ToLower()];

-            if (name2key.ContainsKey(toAgentName))
-            {
-                if (name2key[toAgentName] != LLUUID.Zero)
-                {
-                    Client.Self.InstantMessage(name2key[toAgentName], message);
-                    return "IM sent to " + name2key[toAgentName].ToStringHyphenated();
-                }
-                else
-                {
-                    return "Lookup failed for " + toAgentName;
-                }
+                Client.Self.InstantMessage(id, message, id);
+                return "Instant Messaged " + id.ToStringHyphenated() + " with message: " + message;
             }
             else
             {
-                // Send the Query
-                DirFindQueryPacket find = new DirFindQueryPacket();
-                find.AgentData.AgentID = Client.Network.AgentID;
-                find.AgentData.SessionID = Client.Network.SessionID;
-                find.QueryData.QueryFlags = 1;
-                find.QueryData.QueryText = Helpers.StringToField(toAgentName);
-                find.QueryData.QueryID = new LLUUID("00000000000000000000000000000001");
-                find.QueryData.QueryStart = 0;
+                return "Name lookup for " + ToAvatarName + " failed";
+            }
+        }

-                Client.Network.SendPacket(find);
-
-                while (!DirLookupComplete)
+        void Avatars_OnAvatarNameSearch(LLUUID queryID, Dictionary<LLUUID, string> avatars)
+        {
+            foreach (KeyValuePair<LLUUID, string> kvp in avatars)
+            {
+                if (kvp.Value.ToLower() == ToAvatarName.ToLower())
                 {
-                    // Wait for
+                    Name2Key[ToAvatarName.ToLower()] = kvp.Key;
+                    NameSearchEvent.Set();
+                    return;
                 }
             }
-
-            return "ERROR: IM TERMINATED";
-        }
-
-        private void OnDirFindReply(Simulator simulator, Packet packet)
-        {
-            ;
         }
     }
 }


Re-sync as necessary where id_edsm is not set

--- EDDiscovery/DB/SystemClass.cs
+++ EDDiscovery/DB/SystemClass.cs
@@ -878,12 +878,28 @@
             {
                 using (SQLiteConnectionED cn = new SQLiteConnectionED())
                 {
-                    using (DbCommand cmd = cn.CreateCommand("SELECT UpdateDate FROM Systems ORDER BY UpdateDate DESC LIMIT 1"))
+                    using (DbCommand cmd = cn.CreateCommand("SELECT UpdateDate FROM Systems WHERE id_edsm != 0 AND id_edsm IS NOT NULL ORDER BY UpdateDate DESC LIMIT 1"))
                     {
                         using (DbDataReader reader = cmd.ExecuteReader())
                         {
                             if (reader.Read() && System.DBNull.Value != reader["UpdateDate"])
                                 lasttime = DateTime.SpecifyKind((DateTime)reader["UpdateDate"], DateTimeKind.Utc);
+                        }
+                    }
+
+                    using (DbCommand cmd = cn.CreateCommand("SELECT UpdateDate FROM Systems WHERE id_edsm == 0 OR id_edsm IS NULL ORDER BY UpdateDate ASC LIMIT 1"))
+                    {
+                        using (DbDataReader reader = cmd.ExecuteReader())
+                        {
+                            if (reader.Read() && System.DBNull.Value != reader["UpdateDate"])
+                            {
+                                DateTime firstnonedsmtime = DateTime.SpecifyKind((DateTime)reader["UpdateDate"], DateTimeKind.Utc);
+
+                                if (firstnonedsmtime < lasttime)
+                                {
+                                    lasttime = firstnonedsmtime;
+                                }
+                            }
                         }
                     }
                 }


minimalbackend stores api reference

minimalbackend stores api reference

--- MinimalBackend.cs
+++ MinimalBackend.cs
@@ -10,6 +10,7 @@

     public abstract class MinimalBackend<T,P> : IGraphBackend<T,P> where T : class
 	{
+        protected RelationsInspectorAPI api;

         #region graph construction

@@ -17,6 +18,7 @@
         // we assume the two sets to be identical, so we're just pass them through
         public virtual IEnumerable<T> Init( IEnumerable<object> targets, RelationsInspectorAPI api )
         {
+            this.api = api;
             return ( targets == null ) ? Enumerable.Empty<T>() : targets.OfType<T>();
         }