Add tests for improved overload resolution. Addreses remaining items in #25235

--- src/Compilers/CSharp/Test/Semantic/Semantics/BetterCandidates.cs
+++ src/Compilers/CSharp/Test/Semantic/Semantics/BetterCandidates.cs
@@ -9,6 +9,7 @@
 using Xunit;
 using System.Linq;
 using System.Diagnostics;
+using System.Collections;

 namespace Microsoft.CodeAnalysis.CSharp.UnitTests
 {
@@ -18,14 +19,14 @@
     /// </summary>
     public class BetterCandidates : CompilingTestBase
     {
-        private CSharpCompilation CreateCompilationWithoutBetterCandidates(string source, CSharpCompilationOptions options = null)
-        {
-            return CreateCompilation(source, options: options, parseOptions: TestOptions.WithoutImprovedOverloadCandidates);
-        }
-        private CSharpCompilation CreateCompilationWithBetterCandidates(string source, CSharpCompilationOptions options = null)
+        private CSharpCompilation CreateCompilationWithoutBetterCandidates(string source, CSharpCompilationOptions options = null, MetadataReference[] references = null)
+        {
+            return CreateCompilation(source, options: options, references: references, parseOptions: TestOptions.WithoutImprovedOverloadCandidates);
+        }
+        private CSharpCompilation CreateCompilationWithBetterCandidates(string source, CSharpCompilationOptions options = null, MetadataReference[] references = null)
         {
             Debug.Assert(TestOptions.Regular.LanguageVersion >= MessageID.IDS_FeatureImprovedOverloadCandidates.RequiredVersion());
-            return CreateCompilation(source, options: options, parseOptions: TestOptions.Regular);
+            return CreateCompilation(source, options: options, references: references, parseOptions: TestOptions.Regular);
         }

         //When a method group contains both instance and static members, we discard the instance members if invoked with a static receiver.
@@ -78,6 +79,345 @@
                 Diagnostic(ErrorCode.ERR_AmbigCall, "M").WithArguments("Program.M(A)", "Program.M(B)").WithLocation(6, 11)
                 );
             var compilation = CreateCompilationWithBetterCandidates(source, options: TestOptions.ReleaseExe).VerifyDiagnostics();
+            CompileAndVerify(compilation, expectedOutput: "2");
+        }
+
+        //When a method group contains both instance and static members, we discard the static members if invoked with an instance receiver.
+        [Fact]
+        public void TestInstanceReceiver02()
+        {
+            var source =
+@"class Program
+{
+    public static void Main()
+    {
+        Program p = new Program();
+        p.Main2();
+    }
+    void Main2()
+    {
+        this.M(null);
+    }
+    public static void M(A a) { System.Console.WriteLine(1); }
+    public void M(B b) { System.Console.WriteLine(2); }
+}
+class A {}
+class B {}
+";
+            CreateCompilationWithoutBetterCandidates(source, options: TestOptions.ReleaseExe).VerifyDiagnostics(
+                // (10,14): error CS0121: The call is ambiguous between the following methods or properties: 'Program.M(A)' and 'Program.M(B)'
+                //         this.M(null);
+                Diagnostic(ErrorCode.ERR_AmbigCall, "M").WithArguments("Program.M(A)", "Program.M(B)").WithLocation(10, 14)
+                );
+            var compilation = CreateCompilationWithBetterCandidates(source, options: TestOptions.ReleaseExe).VerifyDiagnostics();
+            CompileAndVerify(compilation, expectedOutput: "2");
+        }
+
+        //When a method group contains both instance and static members, we discard the static members if invoked with an instance receiver.
+        [Fact]
+        public void TestInstanceReceiver03()
+        {
+            var source =
+@"class Program
+{
+    public static void Main()
+    {
+        new MyCollection { null };
+    }
+}
+class A {}
+class B {}
+class MyCollection : System.Collections.IEnumerable
+{
+    public static void Add(A a) { System.Console.WriteLine(1); }
+    public void Add(B b) { System.Console.WriteLine(2); }
+    System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
+    {
+        throw new System.NotImplementedException();
+    }
+}
+";
+            CreateCompilationWithoutBetterCandidates(source, options: TestOptions.ReleaseExe).VerifyDiagnostics(
+                // (5,28): error CS0121: The call is ambiguous between the following methods or properties: 'MyCollection.Add(A)' and 'MyCollection.Add(B)'
+                //         new MyCollection { null };
+                Diagnostic(ErrorCode.ERR_AmbigCall, "null").WithArguments("MyCollection.Add(A)", "MyCollection.Add(B)").WithLocation(5, 28)
+                );
+            var compilation = CreateCompilationWithBetterCandidates(source, options: TestOptions.ReleaseExe).VerifyDiagnostics();
+            CompileAndVerify(compilation, expectedOutput: "2");
+        }
+
+        //When a method group contains both instance and static members, we discard the static members if invoked with an instance receiver.
+        [Fact]
+        public void TestInstanceReceiver04()
+        {
+            var source =
+@"class Program
+{
+    public static void Main()
+    {
+        var c = new MyCollection();
+        foreach (var q in c) { }
+    }
+}
+class A {}
+class B {}
+class MyCollection : System.Collections.IEnumerable
+{
+    public static System.Collections.IEnumerator GetEnumerator()
+    {
+        throw new System.NotImplementedException();
+    }
+    System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
+    {
+        System.Console.Write(1);
+        return new MyEnumerator();
+    }
+}
+class MyEnumerator : System.Collections.IEnumerator
+{
+    object System.Collections.IEnumerator.Current => throw null;
+    bool System.Collections.IEnumerator.MoveNext()
+    {
+        System.Console.WriteLine(2);
+        return false;
+    }
+    void System.Collections.IEnumerator.Reset() => throw null;
+}
+";
+            CreateCompilationWithoutBetterCandidates(source, options: TestOptions.ReleaseExe).VerifyDiagnostics(
+                // (6,27): warning CS0279: 'MyCollection' does not implement the 'collection' pattern. 'MyCollection.GetEnumerator()' is either static or not public.
+                //         foreach (var q in c) { }
+                Diagnostic(ErrorCode.WRN_PatternStaticOrInaccessible, "c").WithArguments("MyCollection", "collection", "MyCollection.GetEnumerator()").WithLocation(6, 27)
+                );
+            var compilation = CreateCompilationWithBetterCandidates(source, options: TestOptions.ReleaseExe).VerifyDiagnostics();
+            CompileAndVerify(compilation, expectedOutput: "12");
+        }
+
+        //When a method group contains both instance and static members, we discard the static members if invoked with an instance receiver.
+        [Fact]
+        public void TestInstanceReceiver05()
+        {
+            var source =
+@"class Program
+{
+    public static void Main()
+    {
+        var c = new MyCollection();
+        foreach (var q in c) { }
+    }
+}
+class A {}
+class B {}
+class MyCollection
+{
+    public MyEnumerator GetEnumerator()
+    {
+        return new MyEnumerator();
+    }
+}
+class MyEnumerator
+{
+    public object Current => throw null;
+    public bool MoveNext()
+    {
+        System.Console.WriteLine(2);
+        return false;
+    }
+    public static bool MoveNext() => throw null;
+}
+";
+            CreateCompilationWithoutBetterCandidates(source, options: TestOptions.ReleaseExe).VerifyDiagnostics(
+                // (26,24): error CS0111: Type 'MyEnumerator' already defines a member called 'MoveNext' with the same parameter types
+                //     public static bool MoveNext() => throw null;
+                Diagnostic(ErrorCode.ERR_MemberAlreadyExists, "MoveNext").WithArguments("MoveNext", "MyEnumerator").WithLocation(26, 24),
+                // (6,27): error CS0202: foreach requires that the return type 'MyEnumerator' of 'MyCollection.GetEnumerator()' must have a suitable public MoveNext method and public Current property
+                //         foreach (var q in c) { }
+                Diagnostic(ErrorCode.ERR_BadGetEnumerator, "c").WithArguments("MyEnumerator", "MyCollection.GetEnumerator()").WithLocation(6, 27)
+                );
+            var compilation = CreateCompilationWithBetterCandidates(source, options: TestOptions.ReleaseExe).VerifyDiagnostics(
+                // (26,24): error CS0111: Type 'MyEnumerator' already defines a member called 'MoveNext' with the same parameter types
+                //     public static bool MoveNext() => throw null;
+                Diagnostic(ErrorCode.ERR_MemberAlreadyExists, "MoveNext").WithArguments("MoveNext", "MyEnumerator").WithLocation(26, 24)
+                );
+        }
+
+        //When a method group contains both instance and static members, we discard the static members if invoked with an instance receiver.
+        [Fact]
+        public void TestInstanceReceiver06()
+        {
+            var source =
+@"class Program
+{
+    public static void Main()
+    {
+        var o = new MyDeconstructable();
+        (var a, var b) = o;
+        System.Console.WriteLine(a);
+    }
+}
+class MyDeconstructable
+{
+    public void Deconstruct(out int a, out int b) => (a, b) = (1, 2);
+    public static void Deconstruct(out long a, out long b) => (a, b) = (3, 4);
+}
+";
+            CreateCompilationWithoutBetterCandidates(source, options: TestOptions.ReleaseExe).VerifyDiagnostics(
+                // (6,26): error CS0121: The call is ambiguous between the following methods or properties: 'MyDeconstructable.Deconstruct(out int, out int)' and 'MyDeconstructable.Deconstruct(out long, out long)'
+                //         (var a, var b) = o;
+                Diagnostic(ErrorCode.ERR_AmbigCall, "o").WithArguments("MyDeconstructable.Deconstruct(out int, out int)", "MyDeconstructable.Deconstruct(out long, out long)").WithLocation(6, 26),
+                // (6,26): error CS8129: No suitable Deconstruct instance or extension method was found for type 'MyDeconstructable', with 2 out parameters and a void return type.
+                //         (var a, var b) = o;
+                Diagnostic(ErrorCode.ERR_MissingDeconstruct, "o").WithArguments("MyDeconstructable", "2").WithLocation(6, 26),
+                // (6,14): error CS8130: Cannot infer the type of implicitly-typed deconstruction variable 'a'.
+                //         (var a, var b) = o;
+                Diagnostic(ErrorCode.ERR_TypeInferenceFailedForImplicitlyTypedDeconstructionVariable, "a").WithArguments("a").WithLocation(6, 14),
+                // (6,21): error CS8130: Cannot infer the type of implicitly-typed deconstruction variable 'b'.
+                //         (var a, var b) = o;
+                Diagnostic(ErrorCode.ERR_TypeInferenceFailedForImplicitlyTypedDeconstructionVariable, "b").WithArguments("b").WithLocation(6, 21)
+                );
+            var compilation = CreateCompilationWithBetterCandidates(source, options: TestOptions.ReleaseExe).VerifyDiagnostics(
+                );
+            CompileAndVerify(compilation, expectedOutput: "1");
+        }
+
+        //When a method group contains both instance and static members, we discard the static members if invoked with an instance receiver.
+        [Fact]
+        public void TestInstanceReceiver07()
+        {
+            var source =
+@"class Program
+{
+    public static void Main()
+    {
+        M(new MyTask<int>(3)).GetAwaiter().GetResult();
+    }
+    static async System.Threading.Tasks.Task M(MyTask<int> x)
+    {
+        var z = await x;
+        System.Console.WriteLine(z);
+    }
+}
+
+public class MyTask<TResult>
+{
+    MyTaskAwaiter<TResult> awaiter;
+    public MyTask(TResult value)
+    {
+        this.awaiter = new MyTaskAwaiter<TResult>(value);
+    }
+    public static MyTaskAwaiter<TResult> GetAwaiter() => null;
+}
+public class MyTaskAwaiter<TResult> : System.Runtime.CompilerServices.INotifyCompletion
+{
+    TResult value;
+    public MyTaskAwaiter(TResult value)
+    {
+        this.value = value;
+    }
+    public bool IsCompleted { get => true; }
+    public TResult GetResult() => value;
+    public void OnCompleted(System.Action continuation) => throw null;
+}
+";
+            CreateCompilationWithoutBetterCandidates(source, options: TestOptions.ReleaseExe).VerifyDiagnostics(
+                // (9,17): error CS1986: 'await' requires that the type MyTask<int> have a suitable GetAwaiter method
+                //         var z = await x;
+                Diagnostic(ErrorCode.ERR_BadAwaitArg, "await x").WithArguments("MyTask<int>").WithLocation(9, 17)
+                );
+            var compilation = CreateCompilationWithBetterCandidates(source, options: TestOptions.ReleaseExe).VerifyDiagnostics(
+                // (9,17): error CS1986: 'await' requires that the type MyTask<int> have a suitable GetAwaiter method
+                //         var z = await x;
+                Diagnostic(ErrorCode.ERR_BadAwaitArg, "await x").WithArguments("MyTask<int>").WithLocation(9, 17)
+                );
+        }
+
+        //When a method group contains both instance and static members, we discard the static members if invoked with an instance receiver.
+        [Fact]
+        public void TestInstanceReceiver08()
+        {
+            var source =
+@"class Program
+{
+    public static void Main()
+    {
+        M(new MyTask<int>(3)).GetAwaiter().GetResult();
+    }
+    static async System.Threading.Tasks.Task M(MyTask<int> x)
+    {
+        var z = await x;
+        System.Console.WriteLine(z);
+    }
+}
+
+public class MyTask<TResult>
+{
+    MyTaskAwaiter<TResult> awaiter;
+    public MyTask(TResult value)
+    {
+        this.awaiter = new MyTaskAwaiter<TResult>(value);
+    }
+    public MyTaskAwaiter<TResult> GetAwaiter() => awaiter;
+}
+public struct MyTaskAwaiter<TResult> : System.Runtime.CompilerServices.INotifyCompletion
+{
+    TResult value;
+    public MyTaskAwaiter(TResult value)
+    {
+        this.value = value;
+    }
+    public bool IsCompleted { get => true; }
+    public static TResult GetResult() => throw null;
+    public void OnCompleted(System.Action continuation) => throw null;
+}
+";
+            CreateCompilationWithoutBetterCandidates(source, options: TestOptions.ReleaseExe).VerifyDiagnostics(
+                // (9,17): error CS0176: Member 'MyTaskAwaiter<int>.GetResult()' cannot be accessed with an instance reference; qualify it with a type name instead
+                //         var z = await x;
+                Diagnostic(ErrorCode.ERR_ObjectProhibited, "await x").WithArguments("MyTaskAwaiter<int>.GetResult()").WithLocation(9, 17)
+                );
+            var compilation = CreateCompilationWithBetterCandidates(source, options: TestOptions.ReleaseExe).VerifyDiagnostics(
+                // (9,17): error CS0176: Member 'MyTaskAwaiter<int>.GetResult()' cannot be accessed with an instance reference; qualify it with a type name instead
+                //         var z = await x;
+                Diagnostic(ErrorCode.ERR_ObjectProhibited, "await x").WithArguments("MyTaskAwaiter<int>.GetResult()").WithLocation(9, 17)
+                );
+        }
+
+        //When a method group contains both instance and static members, we discard the static members if invoked with an instance receiver.
+        [Fact]
+        public void TestInstanceReceiver09()
+        {
+            var source =
+@"using System;
+class Program
+{
+    static void Main()
+    {
+        var q = from x in new Q() select x;
+    }
+}
+class Q
+{
+    public static object Select(Func<A, A> y)
+    {
+        Console.WriteLine(1);
+        return null;
+    }
+    public object Select(Func<B, B> y)
+    {
+        Console.WriteLine(2);
+        return null;
+    }
+}
+class A {}
+class B {}
+";
+            CreateCompilationWithoutBetterCandidates(source, options: TestOptions.ReleaseExe).VerifyDiagnostics(
+                // (6,35): error CS1940: Multiple implementations of the query pattern were found for source type 'Q'.  Ambiguous call to 'Select'.
+                //         var q = from x in new Q() select x;
+                Diagnostic(ErrorCode.ERR_QueryMultipleProviders, "select x").WithArguments("Q", "Select").WithLocation(6, 35)
+                );
+            var compilation = CreateCompilationWithBetterCandidates(source, options: TestOptions.ReleaseExe).VerifyDiagnostics(
+                );
             CompileAndVerify(compilation, expectedOutput: "2");
         }

@@ -198,6 +538,35 @@
                 // (6,9): error CS0182: An attribute argument must be a constant expression, typeof expression or array creation expression of an attribute parameter type
                 //     [My(M(null))]
                 Diagnostic(ErrorCode.ERR_BadAttributeArgument, "M(null)").WithLocation(6, 9)
+                );
+        }
+
+        //When a method group contains no receiver in a static context, we include only static members.
+        // In a default parameter value
+        [Fact]
+        public void TestStaticContext06()
+        {
+            var source =
+@"public class Program
+{
+    public static int M(A a) { System.Console.WriteLine(1); return 1; }
+    public int M(B b) { System.Console.WriteLine(2); return 2; }
+    public void Q(int x = M(null))
+    {
+    }
+}
+public class A {}
+public class B {}
+";
+            CreateCompilationWithoutBetterCandidates(source, options: TestOptions.ReleaseDll).VerifyDiagnostics(
+                // (5,27): error CS0121: The call is ambiguous between the following methods or properties: 'Program.M(A)' and 'Program.M(B)'
+                //     public void Q(int x = M(null))
+                Diagnostic(ErrorCode.ERR_AmbigCall, "M").WithArguments("Program.M(A)", "Program.M(B)").WithLocation(5, 27)
+                );
+            CreateCompilationWithBetterCandidates(source, options: TestOptions.ReleaseDll).VerifyDiagnostics(
+                // (5,27): error CS0121: The call is ambiguous between the following methods or properties: 'Program.M(A)' and 'Program.M(B)'
+                //     public void Q(int x = M(null))
+                Diagnostic(ErrorCode.ERR_AmbigCall, "M").WithArguments("Program.M(A)", "Program.M(B)").WithLocation(5, 27)
                 );
         }

@@ -389,6 +758,37 @@
             CompileAndVerify(compilation, expectedOutput: "2");
         }

+        //For a method group conversion, candidate methods whose return ref kind doesn't match up with the delegate's return ref kind are removed from the set.
+        [Fact]
+        public void TestReturnRefMismatch02()
+        {
+            var source =
+@"public class Program
+{
+    static int tmp = 2;
+    static void Main()
+    {
+        M(Q);
+    }
+
+    static void M(D1 d) { System.Console.WriteLine(1); }
+    static void M(D2 d) { System.Console.WriteLine(2); }
+
+    static int Q() { return tmp; }
+}
+delegate int D1();
+delegate ref int D2();
+";
+            CreateCompilationWithoutBetterCandidates(source, options: TestOptions.ReleaseExe).VerifyDiagnostics(
+                // (6,9): error CS0121: The call is ambiguous between the following methods or properties: 'Program.M(D1)' and 'Program.M(D2)'
+                //         M(Q);
+                Diagnostic(ErrorCode.ERR_AmbigCall, "M").WithArguments("Program.M(D1)", "Program.M(D2)").WithLocation(6, 9)
+                );
+            var compilation = CreateCompilationWithBetterCandidates(source, options: TestOptions.ReleaseExe).VerifyDiagnostics(
+                );
+            CompileAndVerify(compilation, expectedOutput: "1");
+        }
+
         //For a method group conversion, candidate methods whose return type doesn't match up with the delegate's return type are removed from the set.
         [Fact]
         public void TestReturnTypeMismatch02()
@@ -517,5 +917,327 @@
                 );
             CompileAndVerify(compilation, expectedOutput: "2", verify: Verification.Skipped);
         }
-    }
-}
+
+        [ClrOnlyFact]
+        public void IndexedPropertyTest01()
+        {
+            var source1 =
+@"Imports System
+Imports System.Runtime.InteropServices
+<Assembly: PrimaryInteropAssembly(0, 0)>
+<Assembly: Guid(""165F752D-E9C4-4F7E-B0D0-CDFD7A36E210"")>
+<ComImport()>
+<Guid(""165F752D-E9C4-4F7E-B0D0-CDFD7A36E211"")>
+Public Class C
+    Public Property P(a As A) As Object
+        Get
+            Return Nothing
+        End Get
+        Set(value As Object)
+        End Set
+    End Property
+    Public Shared Property P(b As B) As Object
+        Get
+            Return Nothing
+        End Get
+        Set(value As Object)
+        End Set
+    End Property
+End Class
+Public Class A
+End Class
+Public Class B
+End Class
+";
+            var reference1 = BasicCompilationUtils.CompileToMetadata(source1, verify: Verification.Passes);
+            var source2 =
+@"class D : C
+{
+    static void Main()
+    {
+    }
+    void M()
+    {
+        object o;
+        o = P[null];
+        P[null] = o;
+        o = this.P[null];
+        base.P[null] = o;
+        o = D.P[null];   // C# does not support static indexed properties
+        D.P[null] = o;   // C# does not support static indexed properties
+    }
+}";
+            CreateCompilationWithoutBetterCandidates(source2, references: new[] { reference1  }, options: TestOptions.ReleaseExe.WithAllowUnsafe(true)).VerifyDiagnostics(
+                // (13,13): error CS0120: An object reference is required for the non-static field, method, or property 'C.P[A]'
+                //         o = D.P[null];
+                Diagnostic(ErrorCode.ERR_ObjectRequired, "D.P[null]").WithArguments("C.P[A]").WithLocation(13, 13),
+                // (14,9): error CS0120: An object reference is required for the non-static field, method, or property 'C.P[A]'
+                //         D.P[null] = o;
+                Diagnostic(ErrorCode.ERR_ObjectRequired, "D.P[null]").WithArguments("C.P[A]").WithLocation(14, 9)
+                );
+            CreateCompilationWithBetterCandidates(source2, references: new[] { reference1 }, options: TestOptions.ReleaseExe.WithAllowUnsafe(true)).VerifyDiagnostics(
+                // (13,13): error CS0120: An object reference is required for the non-static field, method, or property 'C.P[A]'
+                //         o = D.P[null];
+                Diagnostic(ErrorCode.ERR_ObjectRequired, "D.P[null]").WithArguments("C.P[A]").WithLocation(13, 13),
+                // (14,9): error CS0120: An object reference is required for the non-static field, method, or property 'C.P[A]'
+                //         D.P[null] = o;
+                Diagnostic(ErrorCode.ERR_ObjectRequired, "D.P[null]").WithArguments("C.P[A]").WithLocation(14, 9)
+                );
+        }
+
+        [Fact]
+        public void TestAmbiguous01()
+        {
+            // test semantic model in the face of ambiguities even when there are static/instance violations
+            var source =
+@"class Program
+{
+    public static void Main()
+    {
+        Program p = null;
+        Program.M(null); // two static candidates
+        p.M(null);       // two instance candidates
+        M(null);         // two static candidates
+    }
+    void Q()
+    {
+        Program Program = null;
+        M(null);         // four candidates
+        Program.M(null); // four candidates
+    }
+    public static void M(A a) => throw null;
+    public void M(B b) => throw null;
+    public static void M(C c) => throw null;
+    public void M(D d) => throw null;
+}
+class A {}
+class B {}
+class C {}
+class D {}
+";
+            CreateCompilationWithoutBetterCandidates(source, options: TestOptions.ReleaseExe).VerifyDiagnostics(
+                // (6,17): error CS0121: The call is ambiguous between the following methods or properties: 'Program.M(A)' and 'Program.M(B)'
+                //         Program.M(null); // two static candidates
+                Diagnostic(ErrorCode.ERR_AmbigCall, "M").WithArguments("Program.M(A)", "Program.M(B)").WithLocation(6, 17),
+                // (7,11): error CS0121: The call is ambiguous between the following methods or properties: 'Program.M(A)' and 'Program.M(B)'
+                //         p.M(null);       // two instance candidates
+                Diagnostic(ErrorCode.ERR_AmbigCall, "M").WithArguments("Program.M(A)", "Program.M(B)").WithLocation(7, 11),
+                // (8,9): error CS0121: The call is ambiguous between the following methods or properties: 'Program.M(A)' and 'Program.M(B)'
+                //         M(null);         // two static candidates
+                Diagnostic(ErrorCode.ERR_AmbigCall, "M").WithArguments("Program.M(A)", "Program.M(B)").WithLocation(8, 9),
+                // (13,9): error CS0121: The call is ambiguous between the following methods or properties: 'Program.M(A)' and 'Program.M(B)'
+                //         M(null);         // four candidates
+                Diagnostic(ErrorCode.ERR_AmbigCall, "M").WithArguments("Program.M(A)", "Program.M(B)").WithLocation(13, 9),
+                // (14,17): error CS0121: The call is ambiguous between the following methods or properties: 'Program.M(A)' and 'Program.M(B)'
+                //         Program.M(null); // four candidates
+                Diagnostic(ErrorCode.ERR_AmbigCall, "M").WithArguments("Program.M(A)", "Program.M(B)").WithLocation(14, 17)
+                );
+            var compilation = CreateCompilationWithBetterCandidates(source, options: TestOptions.ReleaseExe).VerifyDiagnostics(
+                // (6,17): error CS0121: The call is ambiguous between the following methods or properties: 'Program.M(A)' and 'Program.M(C)'
+                //         Program.M(null); // two static candidates
+                Diagnostic(ErrorCode.ERR_AmbigCall, "M").WithArguments("Program.M(A)", "Program.M(C)").WithLocation(6, 17),
+                // (7,11): error CS0121: The call is ambiguous between the following methods or properties: 'Program.M(B)' and 'Program.M(D)'
+                //         p.M(null);       // two instance candidates
+                Diagnostic(ErrorCode.ERR_AmbigCall, "M").WithArguments("Program.M(B)", "Program.M(D)").WithLocation(7, 11),
+                // (8,9): error CS0121: The call is ambiguous between the following methods or properties: 'Program.M(A)' and 'Program.M(C)'
+                //         M(null);         // two static candidates
+                Diagnostic(ErrorCode.ERR_AmbigCall, "M").WithArguments("Program.M(A)", "Program.M(C)").WithLocation(8, 9),
+                // (13,9): error CS0121: The call is ambiguous between the following methods or properties: 'Program.M(A)' and 'Program.M(B)'
+                //         M(null);         // four candidates
+                Diagnostic(ErrorCode.ERR_AmbigCall, "M").WithArguments("Program.M(A)", "Program.M(B)").WithLocation(13, 9),
+                // (14,17): error CS0121: The call is ambiguous between the following methods or properties: 'Program.M(A)' and 'Program.M(B)'
+                //         Program.M(null); // four candidates
+                Diagnostic(ErrorCode.ERR_AmbigCall, "M").WithArguments("Program.M(A)", "Program.M(B)").WithLocation(14, 17)
+                );
+            var model = compilation.GetSemanticModel(compilation.SyntaxTrees[0]);
+            var invocations = compilation.SyntaxTrees[0].GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().ToArray();
+            Assert.Equal(5, invocations.Length);
+
+            var symbolInfo = model.GetSymbolInfo(invocations[0].Expression);
+            Assert.Equal(CandidateReason.OverloadResolutionFailure, symbolInfo.CandidateReason);
+            Assert.Equal(4, symbolInfo.CandidateSymbols.Length);
+            Assert.Equal("void Program.M(A a)", symbolInfo.CandidateSymbols[0].ToTestDisplayString());
+            Assert.Equal("void Program.M(B b)", symbolInfo.CandidateSymbols[1].ToTestDisplayString());
+            Assert.Equal("void Program.M(C c)", symbolInfo.CandidateSymbols[2].ToTestDisplayString());
+            Assert.Equal("void Program.M(D d)", symbolInfo.CandidateSymbols[3].ToTestDisplayString());
+
+            symbolInfo = model.GetSymbolInfo(invocations[1].Expression);
+            Assert.Equal(CandidateReason.OverloadResolutionFailure, symbolInfo.CandidateReason);
+            Assert.Equal(4, symbolInfo.CandidateSymbols.Length);
+            Assert.Equal("void Program.M(A a)", symbolInfo.CandidateSymbols[0].ToTestDisplayString());
+            Assert.Equal("void Program.M(B b)", symbolInfo.CandidateSymbols[1].ToTestDisplayString());
+            Assert.Equal("void Program.M(C c)", symbolInfo.CandidateSymbols[2].ToTestDisplayString());
+            Assert.Equal("void Program.M(D d)", symbolInfo.CandidateSymbols[3].ToTestDisplayString());
+
+            symbolInfo = model.GetSymbolInfo(invocations[2].Expression);
+            Assert.Equal(CandidateReason.OverloadResolutionFailure, symbolInfo.CandidateReason);
+            Assert.Equal(4, symbolInfo.CandidateSymbols.Length);
+            Assert.Equal("void Program.M(A a)", symbolInfo.CandidateSymbols[0].ToTestDisplayString());
+            Assert.Equal("void Program.M(B b)", symbolInfo.CandidateSymbols[1].ToTestDisplayString());
+            Assert.Equal("void Program.M(C c)", symbolInfo.CandidateSymbols[2].ToTestDisplayString());
+            Assert.Equal("void Program.M(D d)", symbolInfo.CandidateSymbols[3].ToTestDisplayString());
+
+            symbolInfo = model.GetSymbolInfo(invocations[3].Expression);
+            Assert.Equal(CandidateReason.OverloadResolutionFailure, symbolInfo.CandidateReason);
+            Assert.Equal(4, symbolInfo.CandidateSymbols.Length);
+            Assert.Equal("void Program.M(A a)", symbolInfo.CandidateSymbols[0].ToTestDisplayString());
+            Assert.Equal("void Program.M(B b)", symbolInfo.CandidateSymbols[1].ToTestDisplayString());
+            Assert.Equal("void Program.M(C c)", symbolInfo.CandidateSymbols[2].ToTestDisplayString());
+            Assert.Equal("void Program.M(D d)", symbolInfo.CandidateSymbols[3].ToTestDisplayString());
+
+            symbolInfo = model.GetSymbolInfo(invocations[4].Expression);
+            Assert.Equal(CandidateReason.OverloadResolutionFailure, symbolInfo.CandidateReason);
+            Assert.Equal(4, symbolInfo.CandidateSymbols.Length);
+            Assert.Equal("void Program.M(A a)", symbolInfo.CandidateSymbols[0].ToTestDisplayString());
+            Assert.Equal("void Program.M(B b)", symbolInfo.CandidateSymbols[1].ToTestDisplayString());
+            Assert.Equal("void Program.M(C c)", symbolInfo.CandidateSymbols[2].ToTestDisplayString());
+            Assert.Equal("void Program.M(D d)", symbolInfo.CandidateSymbols[3].ToTestDisplayString());
+        }
+
+        [Fact]
+        public void TestAmbiguous02()
+        {
+            // test semantic model in the face of ambiguities even when there are constraint violations
+            var source =
+@"class Program
+{
+    public static void Main()
+    {
+        M(1, null);
+    }
+    public static void M<T>(T t, A a) where T : Constraint => throw null;
+    public static void M<T>(T t, B b) => throw null;
+    public static void M<T>(T t, C c) where T : Constraint => throw null;
+    public static void M<T>(T t, D d) => throw null;
+}
+class A {}
+class B {}
+class C {}
+class D {}
+class Constraint {}
+";
+            CreateCompilationWithoutBetterCandidates(source, options: TestOptions.ReleaseExe).VerifyDiagnostics(
+                // (5,9): error CS0121: The call is ambiguous between the following methods or properties: 'Program.M<T>(T, A)' and 'Program.M<T>(T, B)'
+                //         M(1, null);
+                Diagnostic(ErrorCode.ERR_AmbigCall, "M").WithArguments("Program.M<T>(T, A)", "Program.M<T>(T, B)").WithLocation(5, 9)
+                );
+            var compilation = CreateCompilationWithBetterCandidates(source, options: TestOptions.ReleaseExe).VerifyDiagnostics(
+                // (5,9): error CS0121: The call is ambiguous between the following methods or properties: 'Program.M<T>(T, B)' and 'Program.M<T>(T, D)'
+                //         M(1, null);
+                Diagnostic(ErrorCode.ERR_AmbigCall, "M").WithArguments("Program.M<T>(T, B)", "Program.M<T>(T, D)").WithLocation(5, 9)
+                );
+            var model = compilation.GetSemanticModel(compilation.SyntaxTrees[0]);
+            var invocations = compilation.SyntaxTrees[0].GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().ToArray();
+            Assert.Equal(1, invocations.Length);
+
+            var symbolInfo = model.GetSymbolInfo(invocations[0].Expression);
+            Assert.Equal(CandidateReason.OverloadResolutionFailure, symbolInfo.CandidateReason);
+            Assert.Equal(4, symbolInfo.CandidateSymbols.Length);
+            Assert.Equal("void Program.M<System.Int32>(System.Int32 t, A a)", symbolInfo.CandidateSymbols[0].ToTestDisplayString());
+            Assert.Equal("void Program.M<System.Int32>(System.Int32 t, B b)", symbolInfo.CandidateSymbols[1].ToTestDisplayString());
+            Assert.Equal("void Program.M<System.Int32>(System.Int32 t, C c)", symbolInfo.CandidateSymbols[2].ToTestDisplayString());
+            Assert.Equal("void Program.M<System.Int32>(System.Int32 t, D d)", symbolInfo.CandidateSymbols[3].ToTestDisplayString());
+        }
+
+        [Fact]
+        public void TestAmbiguous03()
+        {
+            // test semantic model in the face of ambiguities even when there are constraint violations
+            var source =
+@"class Program
+{
+    public static void Main()
+    {
+        1.M(null);
+    }
+}
+public class A {}
+public class B {}
+public class C {}
+public class D {}
+public class Constraint {}
+public static class Extensions
+{
+    public static void M<T>(this T t, A a) where T : Constraint => throw null;
+    public static void M<T>(this T t, B b) => throw null;
+    public static void M<T>(this T t, C c) where T : Constraint => throw null;
+    public static void M<T>(this T t, D d) => throw null;
+}
+";
+            CreateCompilationWithoutBetterCandidates(source, options: TestOptions.ReleaseExe).VerifyDiagnostics(
+                // (5,11): error CS0121: The call is ambiguous between the following methods or properties: 'Extensions.M<T>(T, A)' and 'Extensions.M<T>(T, B)'
+                //         1.M(null);
+                Diagnostic(ErrorCode.ERR_AmbigCall, "M").WithArguments("Extensions.M<T>(T, A)", "Extensions.M<T>(T, B)").WithLocation(5, 11)
+                );
+            var compilation = CreateCompilationWithBetterCandidates(source, options: TestOptions.ReleaseExe).VerifyDiagnostics(
+                // (5,11): error CS0121: The call is ambiguous between the following methods or properties: 'Extensions.M<T>(T, B)' and 'Extensions.M<T>(T, D)'
+                //         1.M(null);
+                Diagnostic(ErrorCode.ERR_AmbigCall, "M").WithArguments("Extensions.M<T>(T, B)", "Extensions.M<T>(T, D)").WithLocation(5, 11)
+                );
+            var model = compilation.GetSemanticModel(compilation.SyntaxTrees[0]);
+            var invocations = compilation.SyntaxTrees[0].GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().ToArray();
+            Assert.Equal(1, invocations.Length);
+
+            var symbolInfo = model.GetSymbolInfo(invocations[0].Expression);
+            Assert.Equal(CandidateReason.OverloadResolutionFailure, symbolInfo.CandidateReason);
+            Assert.Equal(4, symbolInfo.CandidateSymbols.Length);
+            Assert.Equal("void System.Int32.M<System.Int32>(A a)", symbolInfo.CandidateSymbols[0].ToTestDisplayString());
+            Assert.Equal("void System.Int32.M<System.Int32>(B b)", symbolInfo.CandidateSymbols[1].ToTestDisplayString());
+            Assert.Equal("void System.Int32.M<System.Int32>(C c)", symbolInfo.CandidateSymbols[2].ToTestDisplayString());
+            Assert.Equal("void System.Int32.M<System.Int32>(D d)", symbolInfo.CandidateSymbols[3].ToTestDisplayString());
+        }
+
+        [Fact]
+        public void TestAmbiguous04()
+        {
+            // test semantic model in the face of ambiguities even when there are return type mismatches
+            var source =
+@"class Program
+{
+    public static void Main()
+    {
+        Invoked(Argument);
+    }
+    public static void Invoked(Delegate d)
+    {
+    }
+    public delegate A Delegate(IZ c);
+
+    static B Argument(IQ x) => null;
+    static D Argument(IW x) => null;
+    static C Argument(IX x) => null;
+    static D Argument(IY x) => null;
+
+}
+class A {} class B: A {} class C: A {}
+class D {}
+interface IQ {}
+interface IW {}
+interface IX {}
+interface IY {}
+interface IZ: IQ, IW, IX, IY {}
+";
+            CreateCompilationWithoutBetterCandidates(source, options: TestOptions.ReleaseExe).VerifyDiagnostics(
+                // (5,17): error CS0121: The call is ambiguous between the following methods or properties: 'Program.Argument(IQ)' and 'Program.Argument(IW)'
+                //         Invoked(Argument);
+                Diagnostic(ErrorCode.ERR_AmbigCall, "Argument").WithArguments("Program.Argument(IQ)", "Program.Argument(IW)").WithLocation(5, 17)
+                );
+            var compilation = CreateCompilationWithBetterCandidates(source, options: TestOptions.ReleaseExe).VerifyDiagnostics(
+                // (5,17): error CS0121: The call is ambiguous between the following methods or properties: 'Program.Argument(IQ)' and 'Program.Argument(IX)'
+                //         Invoked(Argument);
+                Diagnostic(ErrorCode.ERR_AmbigCall, "Argument").WithArguments("Program.Argument(IQ)", "Program.Argument(IX)").WithLocation(5, 17)
+                );
+            var model = compilation.GetSemanticModel(compilation.SyntaxTrees[0]);
+            var invocations = compilation.SyntaxTrees[0].GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().ToArray();
+            Assert.Equal(1, invocations.Length);
+
+            var symbolInfo = model.GetSymbolInfo(invocations[0].ArgumentList.Arguments[0].Expression);
+            Assert.Equal(CandidateReason.OverloadResolutionFailure, symbolInfo.CandidateReason);
+            Assert.Equal(4, symbolInfo.CandidateSymbols.Length);
+            Assert.Equal("B Program.Argument(IQ x)", symbolInfo.CandidateSymbols[0].ToTestDisplayString());
+            Assert.Equal("D Program.Argument(IW x)", symbolInfo.CandidateSymbols[1].ToTestDisplayString());
+            Assert.Equal("C Program.Argument(IX x)", symbolInfo.CandidateSymbols[2].ToTestDisplayString());
+            Assert.Equal("D Program.Argument(IY x)", symbolInfo.CandidateSymbols[3].ToTestDisplayString());
+        }
+    }
+}


tidy 11fba23

tidy 11fba23

--- src/FilterLists.Data/Seed/Extensions/SeedFilterListsDbContext.cs
+++ src/FilterLists.Data/Seed/Extensions/SeedFilterListsDbContext.cs
@@ -151,15 +151,15 @@

         private static void SetDefaultLicenseId(this DbContext dbContext)
         {
-            var lists = dbContext.Set<FilterList>()
-                                 .Where(l => l.LicenseId == null)
-                                 .ToList()
-                                 .Select(c =>
-                                 {
-                                     c.LicenseId = 5;
-                                     return c;
-                                 });
-            dbContext.UpdateRange(lists);
+            var listsWithoutLicense = dbContext.Set<FilterList>()
+                                               .Where(l => l.LicenseId == null)
+                                               .ToList()
+                                               .Select(l =>
+                                               {
+                                                   l.LicenseId = 5;
+                                                   return l;
+                                               });
+            dbContext.UpdateRange(listsWithoutLicense);
             dbContext.SaveChanges();
         }
     }


Style fix and comments

Style fix and comments

--- src/FubarDev.FtpServer.FileSystem.DotNet/DotNetDirectoryEntry.cs
+++ src/FubarDev.FtpServer.FileSystem.DotNet/DotNetDirectoryEntry.cs
@@ -43,6 +43,27 @@
         /// <inheritdoc/>
         public bool IsDeletable => CheckIfDeletable();

+        /// <summary>
+        /// Check if the directory has child entries.
+        /// </summary>
+        /// <param name="directoryInfo">The directory that gets checked for child entries.</param>
+        /// <returns><see langword="null"/> when an exception occurred.</returns>
+        private static bool? HasChildEntries(DirectoryInfo directoryInfo)
+        {
+            try
+            {
+                return directoryInfo.EnumerateFileSystemInfos().Any();
+            }
+            catch
+            {
+                return null;
+            }
+        }
+
+        /// <summary>
+        /// Checks if a directory is deletable.
+        /// </summary>
+        /// <returns><see langword="true"/> when the directory is deletable.</returns>
         private bool CheckIfDeletable()
         {
             // Root directory is never deletable.
@@ -63,17 +84,5 @@
             // We allow deletion if we either allow it globally or when the directory has no child entries.
             return _allowDeleteIfNotEmpty || !hasChildEntries.Value;
         }
-
-        private static bool? HasChildEntries(DirectoryInfo directoryInfo)
-        {
-            try
-            {
-                return directoryInfo.EnumerateFileSystemInfos().Any();
-            }
-            catch
-            {
-                return null;
-            }
-        }
     }
 }


Fix warning as error

Fix warning as error

--- src/NUnitFramework/framework/Internal/Commands/MaxTimeCommand.cs
+++ src/NUnitFramework/framework/Internal/Commands/MaxTimeCommand.cs
@@ -33,8 +33,6 @@
     /// </summary>
     public class MaxTimeCommand : AfterTestCommand
     {
-        private int maxTime;
-
         /// <summary>
         /// Initializes a new instance of the <see cref="MaxTimeCommand"/> class.
         /// </summary>
@@ -43,7 +41,6 @@
         public MaxTimeCommand(TestCommand innerCommand, int maxTime)
             : base(innerCommand)
         {
-            this.maxTime = maxTime;
             AfterTest = (context) =>
             {
                 // TODO: This command duplicates the calculation of the


changed times

changed times

- days to day(s)
- hours to hour(s)
- minutes to minute(s)

--- src/NadekoBot/Modules/Administration/Commands/MessageRepeater.cs
+++ src/NadekoBot/Modules/Administration/Commands/MessageRepeater.cs
@@ -159,7 +159,7 @@
                     return old;
                 });

-                await channel.SendMessageAsync($"🔁 Repeating **\"{rep.Repeater.Message}\"** every `{rep.Repeater.Interval.Days} days, {rep.Repeater.Interval.Hours} hours and {rep.Repeater.Interval.Minutes} minutes`.").ConfigureAwait(false);
+                await channel.SendMessageAsync($"🔁 Repeating **\"{rep.Repeater.Message}\"** every `{rep.Repeater.Interval.Days} day(s), {rep.Repeater.Interval.Hours} hour(s) and {rep.Repeater.Interval.Minutes} minute(s)`.").ConfigureAwait(false);
             }
         }
     }


#3146 Shift+Tab in 'Import Data from text file' closes the dialog

--- src/Package/Impl/DataInspect/DataImport/ImportDataWindow.xaml.cs
+++ src/Package/Impl/DataInspect/DataImport/ImportDataWindow.xaml.cs
@@ -369,7 +369,9 @@
         }

         private void RunButton_PreviewKeyUp(object sender, KeyEventArgs e) {
-            DoDefaultAction().DoNotWait();
+            if (e.Key == Key.Enter || e.Key == Key.Space) {
+                DoDefaultAction().DoNotWait();
+            }
         }

         private void CancelButton_Click(object sender, RoutedEventArgs e) {
@@ -377,7 +379,9 @@
         }

         private void CancelButton_PreviewKeyUp(object sender, KeyEventArgs e) {
-            Close();
+            if (e.Key == Key.Enter || e.Key == Key.Space) {
+                Close();
+            }
         }
     }
 }


show account id on interim homepage

show account id on interim homepage

--- src/SFA.DAS.EmployerAccounts.Web/Views/EmployerTeam/Index.cshtml
+++ src/SFA.DAS.EmployerAccounts.Web/Views/EmployerTeam/Index.cshtml
@@ -20,10 +20,13 @@
     }
 }

-
+@*

+    @Model.Data.Account.Name
+    Account ID: @Model.Data.Account.PublicHashedId
+
*@

-        Your employer account
+        Account ID: @Model.Data.Account.PublicHashedId

@Model.Data.Account.Name


Update error message content as per accpetance criteria.

--- src/SFA.DAS.EmployerAccounts.Web/Views/Home/WhatYoullNeed.cshtml
+++ src/SFA.DAS.EmployerAccounts.Web/Views/Home/WhatYoullNeed.cshtml
@@ -24,7 +24,7 @@
                     <legend class="form-label-bold">
                         Do you have everything you need?

-                            You need your Government Gateway login details to create an account
+                            You need your Government Gateway login details to access your levy funds

                     </legend>


- Made ConnectionStringName property public

--- src/SenDev.Xaf.ApplicationServerHosting.Web/ApplicationServer.cs
+++ src/SenDev.Xaf.ApplicationServerHosting.Web/ApplicationServer.cs
@@ -361,7 +361,7 @@
         }

-        protected static string ConnectionStringName { get; set; } = "ConnectionString";
+        public static string ConnectionStringName { get; set; } = "ConnectionString";

         private WcfSecuredDataServer Server
         {


Removing unused function parameters

Removing unused function parameters

--- src/UnityExtension/Assets/Editor/GitHub.Unity/UI/BranchesView.cs
+++ src/UnityExtension/Assets/Editor/GitHub.Unity/UI/BranchesView.cs
@@ -101,8 +101,7 @@
                 localBranches = Repository.LocalBranches.ToList();
                 remoteBranches = Repository.RemoteBranches.ToList();

-
-                BuildTree(localBranches, remoteBranches);
+                BuildTree();
             }

             disableDelete = treeLocals.SelectedNode == null || treeLocals.SelectedNode.IsFolder || treeLocals.SelectedNode.IsActive;
@@ -147,7 +146,7 @@
             GUILayout.EndScrollView();
         }

-        private void BuildTree(List<GitBranch> localBranches, List<GitBranch> remoteBranches)
+        private void BuildTree()
         {
             localBranches.Sort(CompareBranches);
             remoteBranches.Sort(CompareBranches);


actually throw exceptions

actually throw exceptions

--- src/Workspaces/Core/MSBuild/MSBuild/Build/ProjectBuildManager.cs
+++ src/Workspaces/Core/MSBuild/MSBuild/Build/ProjectBuildManager.cs
@@ -1,4 +1,4 @@
-// Licensed to the .NET Foundation under one or more agreements.
+// Licensed to the .NET Foundation under one or more agreements.
 // The .NET Foundation licenses this file to you under the MIT license.
 // See the LICENSE file in the project root for more information.

@@ -67,7 +67,7 @@
         {
             if (_batchBuildStarted)
             {
-                new InvalidOperationException("ProjectBuilderManager.Stop() not called.");
+                throw new InvalidOperationException("ProjectBuilderManager.Stop() not called.");
             }
         }


real qr decompositon: minor code style fix

--- src/app/MathNet.Iridium/Library/LinearAlgebra/QRDecomposition.cs
+++ src/app/MathNet.Iridium/Library/LinearAlgebra/QRDecomposition.cs
@@ -346,19 +346,21 @@
                 Q[k][k] = 1.0;
                 for(int j = k; j < Math.Min(m, n); j++)
                 {
-                    if(QR[k][k] != 0.0)
-                    {
-                        double s = 0.0;
-                        for(int i = k; i < m; i++)
-                        {
-                            s += QR[i][k] * Q[i][j];
-                        }
-
-                        s = (-s) / QR[k][k];
-                        for(int i = k; i < m; i++)
-                        {
-                            Q[i][j] += s * QR[i][k];
-                        }
+                    if(QR[k][k] == 0.0)
+                    {
+                        continue;
+                    }
+
+                    double s = 0.0;
+                    for(int i = k; i < m; i++)
+                    {
+                        s += QR[i][k] * Q[i][j];
+                    }
+
+                    s = (-s) / QR[k][k];
+                    for(int i = k; i < m; i++)
+                    {
+                        Q[i][j] += s * QR[i][k];
                     }
                 }


Update dictator with attributes retrieval optimization

--- src/Arango/Arango.Client/ExternalLibraries/dictator/Dictator.cs
+++ src/Arango/Arango.Client/ExternalLibraries/dictator/Dictator.cs
@@ -68,32 +68,44 @@
             }
             else
             {
+                string fieldName;
+                object propertyValue;
+                IEnumerable<Attribute> customAttributes;
+                bool skipField;
+
                 foreach (var propertyInfo in inputObjectType.GetProperties(BindingFlags.Public | BindingFlags.Instance))
-                {
-                    // skip property if it should be ingored
-                    if (propertyInfo.IsDefined(typeof(IgnoreField)))
+                {
+                    fieldName = propertyInfo.Name;
+                    propertyValue = propertyInfo.GetValue(obj);
+                    customAttributes = propertyInfo.GetCustomAttributes();
+                    skipField = false;
+
+                    foreach (var attribute in customAttributes)
+                    {
+                        // skip property if it should be ingored
+                        if (attribute is IgnoreField)
+                        {
+                            skipField = true;
+                        }
+                        // skip property if it should ingore null value
+                        else if ((attribute is IgnoreNullValue) && (propertyValue == null))
+                        {
+                            skipField = true;
+                        }
+                        // set field name as property alias if present
+                        else if (attribute is AliasField)
+                        {
+                            var aliasFieldAttribute = (AliasField)propertyInfo.GetCustomAttribute(typeof(AliasField));
+
+                            fieldName = aliasFieldAttribute.Alias;
+                        }
+                    }
+
+                    if (skipField)
                     {
                         continue;
                     }
-
-                    var propertyValue = propertyInfo.GetValue(obj);
-
-                    // skip property if it should ingore null value
-                    if (propertyInfo.IsDefined(typeof(IgnoreNullValue)) && (propertyValue == null))
-                    {
-                        continue;
-                    }
-
-                    var fieldName = propertyInfo.Name;
-
-                    // set field name as property alias if present
-                    if (propertyInfo.IsDefined(typeof(AliasField)))
-                    {
-                        var aliasFieldAttribute = (AliasField)propertyInfo.GetCustomAttribute(typeof(AliasField));
-
-                        fieldName = aliasFieldAttribute.Alias;
-                    }
-
+
                     if (propertyValue == null)
                     {
                         document.Object(fieldName, null);


Fix Menu selection to match UWP.

Fix Menu selection to match UWP.

--- src/Avalonia.Controls/Platform/DefaultMenuInteractionHandler.cs
+++ src/Avalonia.Controls/Platform/DefaultMenuInteractionHandler.cs
@@ -56,6 +56,7 @@
             Menu.AddHandler(Avalonia.Controls.Menu.MenuOpenedEvent, this.MenuOpened);
             Menu.AddHandler(MenuItem.PointerEnterItemEvent, PointerEnter);
             Menu.AddHandler(MenuItem.PointerLeaveItemEvent, PointerLeave);
+            Menu.AddHandler(InputElement.PointerMovedEvent, PointerMoved);

             _root = Menu.VisualRoot;

@@ -91,6 +92,7 @@
             Menu.RemoveHandler(Avalonia.Controls.Menu.MenuOpenedEvent, this.MenuOpened);
             Menu.RemoveHandler(MenuItem.PointerEnterItemEvent, PointerEnter);
             Menu.RemoveHandler(MenuItem.PointerLeaveItemEvent, PointerLeave);
+            Menu.RemoveHandler(InputElement.PointerMovedEvent, PointerMoved);

             if (_root is InputElement inputRoot)
             {
@@ -340,6 +342,21 @@
             }
         }

+        protected internal virtual void PointerMoved(object? sender, PointerEventArgs e)
+        {
+            var item = GetMenuItem(e.Source as IControl) as MenuItem;
+            if (item?.TransformedBounds == null)
+            {
+                return;
+            }
+            var point = e.GetCurrentPoint(null);
+
+            if (point.Properties.IsLeftButtonPressed && item.TransformedBounds.Value.Contains(point.Position) == false)
+            {
+                e.Pointer.Capture(null);
+            }
+        }
+
         protected internal virtual void PointerLeave(object? sender, PointerEventArgs e)
         {
             var item = GetMenuItem(e.Source as IControl);


Updated BitSetFilter.cs to 4.0.2 compatibility.

--- src/BoboBrowse.Net/BoboBrowse.Net/Facets/Filter/BitSetFilter.cs
+++ src/BoboBrowse.Net/BoboBrowse.Net/Facets/Filter/BitSetFilter.cs
@@ -17,7 +17,7 @@
 //* See the License for the specific language governing permissions and
 //* limitations under the License.

-// Version compatibility level: 3.2.0
+// Version compatibility level: 4.0.2
 namespace BoboBrowse.Net.Facets.Filter
 {
     using BoboBrowse.Net.DocIdSet;
@@ -27,8 +27,6 @@

     public class BitSetFilter : RandomAccessFilter
     {
-        //private static long serialVersionUID = 1L; // NOT USED
-
         protected readonly IFacetDataCacheBuilder facetDataCacheBuilder;
         protected readonly IBitSetBuilder bitSetBuilder;
         private volatile OpenBitSet bitSet;
@@ -83,7 +81,7 @@
                 _dataCache = dataCache;
             }

-            public override DocIdSetIterator Iterator()
+            public override DocIdSetIterator GetIterator()
             {
                 if (_multi)
                 {


Added timeout to requests.

Added timeout to requests.

--- src/Buildron/Assets/_Assets/Scripts/Infrastructure/Requester.cs
+++ src/Buildron/Assets/_Assets/Scripts/Infrastructure/Requester.cs
@@ -8,8 +8,9 @@
 using Skahal.Common;
 using System.Collections.Generic;
 using Buildron.Infrastructure;
+using Skahal.Threading;
 #endregion
-
+
 public class Requester : MonoBehaviour
 {
 	#region Constants
@@ -126,11 +127,11 @@
 		});
 	}

-	public void GetTexture (string url, Action<Texture2D> responseReceived)
-	{
-		m_requestsQueue.Enqueue (() =>
-		{
-			StartCoroutine (DoGet (url, responseReceived));
+	public void GetTexture (string url, Action<Texture2D> responseReceived, Action errorReceived = null)
+	{
+		m_requestsQueue.Enqueue (() =>
+		{
+			StartCoroutine (DoGet (url, responseReceived, errorReceived));
 		});
 	}

@@ -150,11 +151,12 @@
 		}, errorReceived);
 	}

-	private IEnumerator DoGet (string url, Action<Texture2D> responseReceived)
+	private IEnumerator DoGet (string url, Action<Texture2D> responseReceived, Action errorReceived = null)
 	{
 		return DoBasicGet (url, (response) => {
 			responseReceived (response.texture);
-		});
+		},
+        errorReceived);
 	}

 	private IEnumerator DoBasicGet (string url, Action<WWW> responseReceived)
@@ -188,9 +190,29 @@
 		}
 		else {
 			request = new WWW (url);
-		}
-
-		yield return request;
+		}
+
+
+        // Timeout
+        SHThread.Start(
+            30,
+            () =>
+            {
+                if(request != null && !request.isDone)
+                {
+                    try
+                    {
+                        SHLog.Warning("Request timeout for url {0}.", url);
+                        request.Dispose();
+                    }
+                    catch(ObjectDisposedException)
+                    {
+                        SHLog.Warning("Request already disposed.", url);
+                    }
+                }
+            });
+
+        yield return request;

 		var status = request.responseHeaders.ContainsKey ("STATUS") ? request.responseHeaders ["STATUS"] : "";

@@ -204,7 +226,7 @@
 			}

 		} else {
-			SHLog.Error ("Error from server to URL '{0}': {1}", url, request.error);
+			SHLog.Warning ("Error from server to URL '{0}': {1}", url, request.error);

 			if (errorReceived != null) {
 				errorReceived ();


Small improvements in CommandManager which allow resubscription in case Application.MainWindow has changed

--- src/Catel.MVVM/Catel.MVVM.NET40/MVVM/Commands/CommandManager.cs
+++ src/Catel.MVVM/Catel.MVVM.NET40/MVVM/Commands/CommandManager.cs
@@ -10,6 +10,8 @@
     using System;
     using System.Collections.Generic;
     using System.Linq;
+    using System.Runtime.CompilerServices;
+    using System.Windows;
     using System.Windows.Input;
     using Catel.Logging;

@@ -38,9 +40,11 @@

 #if NET
         private bool _subscribedToApplicationActivedEvent;
-#endif
-
+        private readonly ConditionalWeakTable<Window, object> _subscribedWindows = new ConditionalWeakTable<Window, object>();
+#else
         private bool _subscribedToKeyboardEvent;
+#endif
+
         private readonly Dictionary<string, InputGesture> _originalCommandGestures = new Dictionary<string, InputGesture>();
         private readonly Dictionary<string, InputGesture> _commandGestures = new Dictionary<string, InputGesture>();
 #endif
@@ -415,13 +419,15 @@
         /// </summary>
         public void SubscribeToKeyboardEvents()
         {
+#if !NET
             if (_subscribedToKeyboardEvent)
             {
                 return;
             }
+#endif

 #if NET || SILVERLIGHT
-            var application = System.Windows.Application.Current;
+            var application = Application.Current;
             if (application == null)
             {
                 Log.Warning("Application.Current is null, cannot subscribe to keyboard events");
@@ -437,21 +443,23 @@
                 {
                     application.Activated += OnApplicationActivated;
                     _subscribedToApplicationActivedEvent = true;
-
                     Log.Info("Application.MainWindow is null, cannot subscribe to keyboard events, subscribed to Application.Activated event");
                 }

                 return;
             }

-            mainWindow.KeyDown += OnKeyDown;
-            _subscribedToKeyboardEvent = true;
+            object obj = null;
+            if (!_subscribedWindows.TryGetValue(mainWindow, out obj))
+            {
+                mainWindow.KeyDown += OnKeyDown;
+                _subscribedWindows.Add(mainWindow, new object());
+            }
 #elif SILVERLIGHT
             var rootVisual = application.RootVisual;
             if (rootVisual == null)
             {
                 Log.Warning("Application.RootVisual is null, cannot subscribe to keyboard events");
-
                 return;
             }

@@ -465,9 +473,6 @@
 #if NET
         private void OnApplicationActivated(object sender, EventArgs e)
         {
-            var application = (System.Windows.Application)sender;
-            application.Activated -= OnApplicationActivated;
-
             SubscribeToKeyboardEvents();
         }
 #endif
@@ -476,6 +481,8 @@
         {
             lock (_lockObject)
             {
+                bool keyHandled = false;
+
                 foreach (var commandGesture in _commandGestures)
                 {
                     var keyGesture = commandGesture.Value;
@@ -484,9 +491,15 @@
                         if (keyGesture.Matches(e))
                         {
                             ExecuteCommand(commandGesture.Key);
+                            keyHandled = true;
                         }
                     }
                 }
+
+                if (keyHandled)
+                {
+                    e.Handled = true;
+                }
             }
         }
 #endif


修改ef存储bug

修改ef存储bug

--- src/DDDLite.Repositories.EntityFramework/DbContextExtensions.cs
+++ src/DDDLite.Repositories.EntityFramework/DbContextExtensions.cs
@@ -40,7 +40,7 @@
                         case EntityState.Modified:
                             var originValues = entry.GetDatabaseValues();
                             entry.CurrentValues[nameof(ITrackable.CreatedAt)] = originValues.GetValue<DateTime?>(nameof(ITrackable.CreatedAt));
-                            entry.CurrentValues[nameof(ITrackable.CreatedById)] = originValues.GetValue<Guid?>(nameof(ITrackable.CreatedById));
+                            entry.CurrentValues[nameof(ITrackable.CreatedById)] = originValues.GetValue<string>(nameof(ITrackable.CreatedById));
                             break;
                     }
                 }


Set a minimum size to the Icarus main options dialog box.

--- src/Extensions/Icarus/Gallio.Icarus/Options/Options.Designer.cs
+++ src/Extensions/Icarus/Gallio.Icarus/Options/Options.Designer.cs
@@ -144,6 +144,7 @@
             this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
             this.MaximizeBox = false;
             this.MinimizeBox = false;
+            this.MinimumSize = new System.Drawing.Size(511, 352);
             this.Name = "Options";
             this.ShowInTaskbar = false;
             this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Show;


Using FastRandomRandomization as default randomization

--- src/GeneticSharp.Domain/Randomizations/RandomizationProvider.cs
+++ src/GeneticSharp.Domain/Randomizations/RandomizationProvider.cs
@@ -11,7 +11,7 @@
         /// </summary>
         static RandomizationProvider()
         {
-            Current = new BasicRandomization();
+            Current = new FastRandomRandomization();
         }
         #endregion


document in-mem login service

document in-mem login service

--- src/IdentityServer4/Quickstart/Services/InMemoryLoginService.cs
+++ src/IdentityServer4/Quickstart/Services/InMemoryLoginService.cs
@@ -1,12 +1,16 @@
 using System.Linq;
 using System.Collections.Generic;
-using System;
 using System.Security.Claims;
 using System.IdentityModel.Tokens.Jwt;
 using IdentityModel;

 namespace IdentityServer4.Quickstart
 {
+    /// <summary>
+    /// Sample implementation of a user login/provisioning services.
+    /// This sample uses an in-memory store and is not suitable for production
+    /// However, feel free to implement this (or a similar logic) using some form of persistent backing store
+    /// </summary>
     public class InMemoryUserLoginService
     {
         private readonly List<InMemoryUser> _users;
@@ -16,6 +20,9 @@
             _users = users;
         }

+        /// <summary>
+        /// Check username and password against in-memory users
+        /// </summary>
         public bool ValidateCredentials(string username, string password)
         {
             var user = FindByUsername(username);
@@ -27,11 +34,17 @@
             return false;
         }

+        /// <summary>
+        /// Find a user by username
+        /// </summary>
         public InMemoryUser FindByUsername(string username)
         {
             return _users.FirstOrDefault(x=>x.Username.Equals(username, System.StringComparison.OrdinalIgnoreCase));
         }

+        /// <summary>
+        /// Find an external user by looking up the name of the provider and the unique id of that user issued by the provider
+        /// </summary>
         public InMemoryUser FindByExternalProvider(string provider, string userId)
         {
             return _users.FirstOrDefault(x =>
@@ -39,21 +52,34 @@
                 x.ProviderId == userId);
         }

+        /// <summary>
+        /// Sample auto-provision logic of new external users
+        /// </summary>
         public InMemoryUser AutoProvisionUser(string provider, string userId, List<Claim> claims)
         {
+            // create a list of claims that we want to transfer into our store
             var filtered = new List<Claim>();
+
             foreach(var claim in claims)
             {
-                if (JwtSecurityTokenHandler.DefaultOutboundClaimTypeMap.ContainsKey(claim.Type))
+                // if the external system sends a display name - translate that to the standard OIDC name claim
+                if (claim.Type == ClaimTypes.Name)
+                {
+                    filtered.Add(new Claim(JwtClaimTypes.Name, claim.Value));
+                }
+                // if the JWT handler has an outbound mapping to an OIDC claim use that
+                else if (JwtSecurityTokenHandler.DefaultOutboundClaimTypeMap.ContainsKey(claim.Type))
                 {
                     filtered.Add(new Claim(JwtSecurityTokenHandler.DefaultOutboundClaimTypeMap[claim.Type], claim.Value));
                 }
+                // copy the claim as-is
                 else
                 {
                     filtered.Add(claim);
                 }
             }

+            // if no display name was provided, try to construct by first and last name
             if (!filtered.Any(x=>x.Type == JwtClaimTypes.Name))
             {
                 var first = filtered.FirstOrDefault(x => x.Type == JwtClaimTypes.GivenName)?.Value;
@@ -64,17 +90,26 @@
                 }
             }

+            // create a new unique subject id
             var sub = CryptoRandom.CreateUniqueId();
+
+            // check if a display name is available, otherwise fallback to subject id
+            var name = filtered.FirstOrDefault(c => c.Type == JwtClaimTypes.Name)?.Value ?? sub;
+
+            // create new user
             var user = new InMemoryUser()
             {
                 Enabled = true,
                 Subject = sub,
-                Username = sub,
+                Username = name,
                 Provider = provider,
                 ProviderId = userId,
                 Claims = filtered
             };
+
+            // add user to in-memory store
             _users.Add(user);
+
             return user;
         }
     }


Some comments on the asteroid sample taking harmony fix (https://github.com/Kerbalism/Kerbalism/issues/458)

--- src/Kerbalism/Patches/ModuleAsteroid_performSampleExperiment.cs
+++ src/Kerbalism/Patches/ModuleAsteroid_performSampleExperiment.cs
@@ -7,15 +7,43 @@

 namespace KERBALISM
 {
-	[HarmonyPatch(typeof(ModuleAsteroid))]
+    /*
+		Fix for sample taking from a ModuleAsteroid.
+		The module search for a ModuleScienceContainer to store the data into, it won't find it with Kerbalism
+		See issue : https://github.com/Kerbalism/Kerbalism/issues/458
+
+		ModuleAsteroid.TakeSampleEVAEvent() code ("Take sample" PAW button callback) :
+		```
+		ModuleScienceContainer collector = FlightGlobals.ActiveVessel.FindPartModuleImplementing<ModuleScienceContainer>();
+		performSampleExperiment(collector);
+		```
+
+		and then in ModuleAsteroid.performSampleExperiment(ModuleScienceContainer collector) :
+		```
+		if (collector.HasData(experimentData))
+		{
+			ScreenMessages.PostScreenMessage("<color=orange>[" + collector.part.partInfo.title + "]: <i>" + experimentData.title + cacheAutoLOC_230121, 5f, ScreenMessageStyle.UPPER_LEFT);
+			return;
+		}
+		GameEvents.OnExperimentDeployed.Fire(experimentData);
+		if (collector.AddData(experimentData))
+		{
+			collector.ReviewData();
+		}
+		```
+	 */
+
+    [HarmonyPatch(typeof(ModuleAsteroid))]
 	[HarmonyPatch("TakeSampleEVAEvent")]
 	class ModuleAsteroid_TakeSampleEVAEvent
 	{
 		static bool Prefix(ModuleAsteroid __instance, ref ScienceExperiment ___experiment)
 		{
+			// Patch only if science is enabled
 			if (!Features.Science) return true;

-			ExperimentSituations experimentSituation = ScienceUtil.GetExperimentSituation(__instance.vessel);
+            // stock ModuleAsteroid.performSampleExperiment code : get situation and check availablility
+            ExperimentSituations experimentSituation = ScienceUtil.GetExperimentSituation(__instance.vessel);
 			string message = string.Empty;
 			if (!ScienceUtil.RequiredUsageExternalAvailable(__instance.vessel, FlightGlobals.ActiveVessel, (ExperimentUsageReqs)__instance.experimentUsageMask, ___experiment, ref message))
 			{
@@ -29,9 +57,10 @@
 				return false;
 			}

-			ScienceSubject subject = ResearchAndDevelopment.GetExperimentSubject(___experiment, experimentSituation, __instance.part.partInfo.name + __instance.part.flightID, __instance.part.partInfo.title, __instance.vessel.mainBody, string.Empty, string.Empty);
-			//subject = ResearchAndDevelopment.GetExperimentSubject(experiment, experimentSituation, base.part.partInfo.name + base.part.flightID, base.part.partInfo.title, base.vessel.mainBody, text, text2);
+            // stock ModuleAsteroid.performSampleExperiment code : create subject
+            ScienceSubject subject = ResearchAndDevelopment.GetExperimentSubject(___experiment, experimentSituation, __instance.part.partInfo.name + __instance.part.flightID, __instance.part.partInfo.title, __instance.vessel.mainBody, string.Empty, string.Empty);

+			// put the data on the EVA kerbal drive.
 			if (FlightGlobals.ActiveVessel == null) return false;
 			double size = ___experiment.baseValue * ___experiment.dataScale;
 			Drive drive = Drive.SampleDrive(FlightGlobals.ActiveVessel, size);
@@ -45,7 +74,9 @@
 			{
 				Message.Post("Not enough sample storage available");
 			}
-			return false;
+
+            // don't call ModuleAsteroid.TakeSampleEVAEvent (this will also prevent the call to ModuleAsteroid.performSampleExperiment)
+            return false;
 		}
 	}
 }


Updated client model

Updated client model

--- src/Libraries/Thinktecture.IdentityServer.Core/Models/Client.cs
+++ src/Libraries/Thinktecture.IdentityServer.Core/Models/Client.cs
@@ -9,7 +9,7 @@
     {
         public string Name { get; set; }
         public string Description { get; set; }
-        public string ReturnUrl { get; set; }
+        public string RedirectUri { get; set; }

         public string ClientId { get; set; }
         public string ClientSecret { get; set; }


Interactive rebuild mode on the projections command

--- src/Marten.CommandLine/Commands/Projection/ProjectionCommand.cs
+++ src/Marten.CommandLine/Commands/Projection/ProjectionCommand.cs
@@ -1,7 +1,6 @@
 using System;
 using System.Linq;
 using System.Reflection;
-using System.Reflection.PortableExecutable;
 using System.Runtime.Loader;
 using System.Threading;
 using System.Threading.Tasks;
@@ -34,6 +33,7 @@
                 return true;
             }

+
             if (input.RebuildFlag)
             {
                 return await Rebuild(input, store);
@@ -45,6 +45,24 @@
         private async Task<bool> Rebuild(ProjectionInput input, DocumentStore store)
         {
             var projections = input.SelectProjections(store);
+
+            if (input.InteractiveFlag)
+            {
+                var projectionNames = store.Events.Projections.Projections.Select(x => x.ProjectionName).ToArray();
+                var names = AnsiConsole.Prompt(new MultiSelectionPrompt<string>()
+                    .Title("Choose projections to rebuild")
+                    .AddChoices(projectionNames));
+
+                projections = store
+                    .Options
+                    .Events
+                    .Projections
+                    .Projections
+                    .Where(x => names.Contains(x.ProjectionName))
+                    .ToList();
+            }
+
+
             if (!projections.Any())
             {
                 Console.WriteLine("No projections to rebuild.");


Remove host's AssemblyInfo file

Remove host's AssemblyInfo file

It doesn't need it for anything.

--- src/Microsoft.PowerShell.Linux.Host/powershell.assembly-info.cs
+++ src/Microsoft.PowerShell.Linux.Host/powershell.assembly-info.cs
@@ -1,4 +0,0 @@
-using System.Runtime.CompilerServices;
-using System.Reflection;
-[assembly:AssemblyFileVersionAttribute("1.0.0.0")]
-[assembly:AssemblyVersion("1.0.0.0")]


Orchard.Widgets: Fixing build warning in WidgetFilter.cs

--- src/Orchard.Web/Modules/Orchard.Widgets/Filters/WidgetFilter.cs
+++ src/Orchard.Web/Modules/Orchard.Widgets/Filters/WidgetFilter.cs
@@ -9,7 +9,6 @@
 using Orchard.Themes;
 using Orchard.UI.Admin;
 using Orchard.Widgets.Services;
-using Orchard.ContentManagement;

 namespace Orchard.Widgets.Filters {
     public class WidgetFilter : FilterProvider, IResultFilter {


More exceptions, flush out bug

More exceptions, flush out bug

--- src/Paramore.Brighter.MessagingGateway.AWSSQS/ChannelFactory.cs
+++ src/Paramore.Brighter.MessagingGateway.AWSSQS/ChannelFactory.cs
@@ -101,7 +101,7 @@
                     {
                         if (snsClient.ListTopicsAsync().Result.Topics.SingleOrDefault(topic => topic.TopicArn == connection.RoutingKey) == null)
                         {
-                            _channelTopicARN = CreateTopic(topicName, sqsClient, snsClient, queueUrl);
+                            CreateTopic(topicName, sqsClient, snsClient, queueUrl);
                         }
                         else
                         {
@@ -143,34 +143,39 @@
             }
         }

-        private string CreateTopic(RoutingKey topicName, AmazonSQSClient sqsClient, AmazonSimpleNotificationServiceClient snsClient, string queueUrl)
+        private void CreateTopic(RoutingKey topicName, AmazonSQSClient sqsClient, AmazonSimpleNotificationServiceClient snsClient, string queueUrl)
         {
             _logger.Value.Debug($"Topic does not exist, creating topic: {topicName} on {_awsConnection.Region}");
             var createTopic = snsClient.CreateTopicAsync(new CreateTopicRequest(topicName)).Result;
             if (!string.IsNullOrEmpty(createTopic.TopicArn))
             {
-                var subscription = snsClient.SubscribeQueueAsync(createTopic.TopicArn, sqsClient, queueUrl).Result;
-                if (!string.IsNullOrEmpty(subscription))
-                {
-                    //We need to support raw messages to allow the use of message attributes
-                    var response = snsClient.SetSubscriptionAttributesAsync(new SetSubscriptionAttributesRequest(subscription, "RawMessageDelivery", "true")).Result;
-                    if (response.HttpStatusCode == HttpStatusCode.OK)
-                    {
-                        return createTopic.TopicArn;
-                    }
-                    else
-                    {
-                        throw new InvalidOperationException($"Unable to set subscription attribute for raw message delivery");
-                    }
-                }
-                else
-                {
-                    throw new InvalidOperationException($"Could not subscribe to topic: {topicName} from queue: {queueUrl} in region {_awsConnection.Region}");
-                }
+                _channelTopicARN = createTopic.TopicArn;
+                BindSubscription(sqsClient, snsClient, queueUrl);
             }
             else
             {
                 throw new InvalidOperationException($"Could not create Topic topic: {topicName} on {_awsConnection.Region}");
+            }
+        }
+
+        private bool BindSubscription(AmazonSQSClient sqsClient,
+            AmazonSimpleNotificationServiceClient snsClient,
+            string queueUrl)
+        {
+            throw new Exception($"Trace variables during bind topic: {_channelTopicARN}, against queue {queueUrl}");
+            var subscription = snsClient.SubscribeQueueAsync(_channelTopicARN, sqsClient, queueUrl).Result;
+            if (!string.IsNullOrEmpty(subscription))
+            {
+                //We need to support raw messages to allow the use of message attributes
+                var response = snsClient.SetSubscriptionAttributesAsync(new SetSubscriptionAttributesRequest(subscription, "RawMessageDelivery", "true")).Result;
+                if (response.HttpStatusCode != HttpStatusCode.OK)
+                {
+                    throw new InvalidOperationException($"Unable to set subscription attribute for raw message delivery");
+                }
+            }
+            else
+            {
+                throw new InvalidOperationException($"Could not subscribe to topic: {_channelTopicARN} from queue: {queueUrl} in region {_awsConnection.Region}");
             }
         }


positional parameters

positional parameters

--- src/RedditSharp.PowerShell/Cmdlets/Reddit/StartRedditSession.cs
+++ src/RedditSharp.PowerShell/Cmdlets/Reddit/StartRedditSession.cs
@@ -26,23 +26,23 @@
         /// <summary>
         /// <para type="description">Reddit password.</para>
         /// </summary>
-        [Parameter(Mandatory = true, Position = 0, HelpMessage = "Reddit password")]
+        [Parameter(Mandatory = true, Position = 1, HelpMessage = "Reddit password")]
         public string Password { get; set; }

         /// <summary>
         /// <para type="description">Reddit Client Id.</para>
         /// </summary>
-        [Parameter(Mandatory = true, Position = 0, HelpMessage = "Reddit app key id")]
+        [Parameter(Mandatory = true, Position = 2, HelpMessage = "Reddit app key id")]
         public string ClientId { get; set; }

         /// <summary>
         /// <para type="description">Reddit Client Secret.</para>
         /// <param type="description">See https://www.reddit.com/prefs/apps/ for more info.</param>
         /// </summary>
-        [Parameter(Mandatory = true, Position = 0, HelpMessage = "Reddit app secret")]
+        [Parameter(Mandatory = true, Position = 3, HelpMessage = "Reddit app secret")]
         public string Secret { get; set; }

-        [Parameter(Mandatory = false, Position = 0, HelpMessage = "Redirect URL")]
+        [Parameter(Mandatory = false, Position = 4, HelpMessage = "Redirect URL")]
         public string RedirectUrl { get; set; }

         protected override void BeginProcessing()


Secures endpoint

Secures endpoint

--- src/SFA.DAS.Commitments.Api/Controllers/ValidationController.cs
+++ src/SFA.DAS.Commitments.Api/Controllers/ValidationController.cs
@@ -23,6 +23,7 @@
         }

         [Route("apprenticeships/overlapping")]
+        [Authorize(Roles = "Role1")]
         public async Task<IHttpActionResult> ValidateOverlappingApprenticeships([FromBody]IEnumerable<ApprenticeshipOverlapValidationRequest> request)
         {
             var result = await _validationOrchestrator.ValidateOverlappingApprenticeships(request);


Update Levy Attribute to check route or filter context for hashed account id

--- src/SFA.DAS.EmployerFinance.Web/Filters/LevyEmployerTypeOnly.cs
+++ src/SFA.DAS.EmployerFinance.Web/Filters/LevyEmployerTypeOnly.cs
@@ -15,13 +15,23 @@
         {
             try
             {
-                if(filterContext.ActionParameters == null || !filterContext.ActionParameters.ContainsKey("HashedAccountId"))
+                string hashedAccountId = string.Empty;
+
+                if(filterContext.ActionParameters != null && filterContext.ActionParameters.ContainsKey("HashedAccountId"))
+                {
+                    hashedAccountId = filterContext.ActionParameters["HashedAccountId"].ToString();
+
+                } else if(filterContext.RouteData?.Values?.ContainsKey("HashedAccountId") == true) {
+
+                    hashedAccountId = filterContext.RouteData.Values["HashedAccountId"].ToString();
+                }
+
+                if(string.IsNullOrWhiteSpace(hashedAccountId))
                 {
                     filterContext.Result = new ViewResult { ViewName = ControllerConstants.BadRequestViewName };
                     return;
                 }
-
-                var hashedAccountId = filterContext.ActionParameters["HashedAccountId"].ToString();
+
                 var accountApi = DependencyResolver.Current.GetService<IAccountApiClient>();

                 var task = Task.Run(async () => await accountApi.GetAccount(hashedAccountId));


Remove inaccurate representation of prefix sample size from placeholder event

--- src/Serilog.Sinks.Seq/Sinks/Seq/ConstrainedBufferedFormatter.cs
+++ src/Serilog.Sinks.Seq/Sinks/Seq/ConstrainedBufferedFormatter.cs
@@ -114,7 +114,7 @@
                 logEvent.Timestamp,
                 LogEventLevel.Error,
                 exception: null,
-                new MessageTemplateParser().Parse("Event JSON representation exceeds the body size limit {EventBodyLimitBytes}; first 1024 bytes: {EventBodySample}"),
+                new MessageTemplateParser().Parse("Event JSON representation exceeds the body size limit {EventBodyLimitBytes}; sample: {EventBodySample}"),
                 new[]
                 {
                     new LogEventProperty("EventBodyLimitBytes", new ScalarValue(eventBodyLimitBytes)),


Fix test logic and naming #1810

Fix test logic and naming #1810

--- src/Tests/ClientConcepts/ConnectionPooling/Sticky/Sticky.doc.cs
+++ src/Tests/ClientConcepts/ConnectionPooling/Sticky/Sticky.doc.cs
@@ -11,9 +11,13 @@
 {
     public class Sticky
     {
+        /** Sticky
+		 * Each connection pool returns the first `live` node so that it is sticky between requests
+		*/
+
         protected int NumberOfNodes = 10;

-        [U] public void EachViewStartsAtNexPositionAndWrapsOver()
+        [U] public void EachViewStartsAtNextPositionAndWrapsOver()
         {
             var uris = Enumerable.Range(9200, NumberOfNodes).Select(p => new Uri("http://localhost:" + p));
             var staticPool = new StickyConnectionPool(uris);
@@ -23,12 +27,20 @@

         public void AssertCreateView(StickyConnectionPool pool)
         {
+            /**
+			* Here we have setup a static connection pool seeded with 10 nodes.
+			* So what order we expect? Imagine the following:
+			*
+			* Thread A calls GetNext and gets returned the first live node
+			* Thread B calls GetNext() and gets returned the same node as it's still the first live.
+			*/
+
             var startingPositions = Enumerable.Range(0, NumberOfNodes)
                 .Select(i => pool.CreateView().First())
                 .Select(n => n.Uri.Port)
                 .ToList();

-            var expectedOrder = Enumerable.Range(9200, NumberOfNodes);
+            var expectedOrder = Enumerable.Repeat(9200, NumberOfNodes);
             startingPositions.Should().ContainInOrder(expectedOrder);
         }
     }


handle null client reference on login view model

--- source/Core/Endpoints/AuthenticationController.cs
+++ source/Core/Endpoints/AuthenticationController.cs
@@ -827,9 +827,9 @@
                 LogoutUrl = context.GetIdentityServerLogoutUrl(),
                 AntiForgery = antiForgeryToken.GetAntiForgeryToken(),
                 Username = username,
-                ClientName = client.ClientName,
-                ClientUrl = client.ClientUri,
-                ClientLogoUrl = client.LogoUri
+                ClientName = client != null ? client.ClientName : null,
+                ClientUrl = client != null ? client.ClientUri : null,
+                ClientLogoUrl = client != null ? client.LogoUri : null
             };

             return new LoginActionResult(viewService, loginModel, message);


Cleaned up the status messages.

Cleaned up the status messages.

--- source/Cosmos/Cosmos.Kernel/Staging/StageQueue.cs
+++ source/Cosmos/Cosmos.Kernel/Staging/StageQueue.cs
@@ -41,12 +41,12 @@
 		public void Run() {
 			while (_initialize.Count != 0) {
 				_current = _initialize.Dequeue ();
-				_current.Initialize ();

-				Console.Write ("Entered stage ");
+				Console.Write ("Entering stage ");
 				Console.Write (Current.Name);
 				Console.WriteLine (".");

+				_current.Initialize ();
 				_teardown.Push (Current);
 			}
 		}
@@ -57,10 +57,12 @@
 		public void Teardown() {
 			while (_teardown.Count != 0) {
 				_current = _teardown.Pop ();
-				_current.Teardown ();
-				Console.Write ("Left stage ");
+
+				Console.Write ("Leaving stage ");
 				Console.Write (Current.Name);
 				Console.WriteLine (".");
+
+				_current.Teardown ();
 			}
 		}
 	}


Fixed some startup entries crashing the junk scan

--- source/UninstallTools/Startup/StartupEntryBase.cs
+++ source/UninstallTools/Startup/StartupEntryBase.cs
@@ -61,7 +61,7 @@
         ///     Combined ParentLongName and EntryLongName
         /// </summary>
         public virtual string FullLongName => ParentLongName != null && EntryLongName != null
-            ? Path.Combine(ParentLongName, EntryLongName)
+            ? PathTools.GenerousCombine(ParentLongName, EntryLongName)
             : null;

         /// <summary>
@@ -100,8 +100,7 @@
             if (string.IsNullOrEmpty(command))
                 return null;

-            ProcessStartCommand temp;
-            return ProcessStartCommand.TryParse(command, out temp) ? temp.FileName : null;
+            return ProcessStartCommand.TryParse(command, out var temp) ? temp.FileName : null;
         }

         /// <summary>


Cleanup code

Cleanup code

--- plugins/TrackableData.Sql/TrackableContainerSqlMapper.cs
+++ plugins/TrackableData.Sql/TrackableContainerSqlMapper.cs
@@ -98,7 +98,7 @@
             where TPoco : ITrackablePoco<TPoco>
         {
             if (mapperParameters.Length != 2)
-                throw new ArgumentException("The length of mapperParameters should be  2");
+                throw new ArgumentException("The length of mapperParameters should be 2");

             var mapper = new TrackablePocoSqlMapper<TPoco>(sqlProvider,
                                                            (string)mapperParameters[0],


Added new ValidationSummary overloads to sample

Overview now shows every possible overload.

#1743

--- samples/MvcSample.Web/Views/Home/ValidationSummary.cshtml
+++ samples/MvcSample.Web/Views/Home/ValidationSummary.cshtml
@@ -9,15 +9,18 @@
 </style>

ValidationSummary Test Page.

-
Below are all overloads for Html.ValidationSummary.  You should see 5 validation summary titles and 4 validation summary error messages.

+
Below are all overloads for Html.ValidationSummary.  You should see 8 validation summary titles and 4 validation summary error messages.

     @Html.ValidationSummary()
     @Html.ValidationSummary(excludePropertyErrors: true)
-    @Html.ValidationSummary(message: "Hello from validation message summary 1.", tag: "h2")
-    @Html.ValidationSummary(excludePropertyErrors: true, message: "Hello from validation message summary 2")
-    @Html.ValidationSummary(message: "Hello from validation message summary 3", htmlAttributes: new { style = "color: red" })
-    @Html.ValidationSummary(excludePropertyErrors: true, message: "Hello from validation message summary 4", htmlAttributes: new { style = "color: green" })
-    @Html.ValidationSummary(message: "Hello from validation message summary 5", htmlAttributes: new Dictionary<string, object> { { "style", "color: blue" } }, tag: "h1")
+    @Html.ValidationSummary(message: "Hello from validation message summary 1.")
+    @Html.ValidationSummary(message: "Hello from validation message summary 2.", tag: "h2")
+    @Html.ValidationSummary(excludePropertyErrors: true, message: "Hello from validation message summary 3")
+    @Html.ValidationSummary(message: "Hello from validation message summary 4", htmlAttributes: new { style = "color: red" })
+    @Html.ValidationSummary(message: "Hello from validation message summary 5", htmlAttributes: new { style = "color: red" }, tag: "h2")
+    @Html.ValidationSummary(excludePropertyErrors: true, message: "Hello from validation message summary 6", tag: "h2")
+    @Html.ValidationSummary(excludePropertyErrors: true, message: "Hello from validation message summary 7", htmlAttributes: new { style = "color: green" })
+    @Html.ValidationSummary(message: "Hello from validation message summary 8", htmlAttributes: new Dictionary<string, object> { { "style", "color: blue" } }, tag: "h2")


BUGFIX: Disable exact assembly version match in signature comparisons during metadata resolution.

--- src/AsmResolver.DotNet/DefaultMetadataResolver.cs
+++ src/AsmResolver.DotNet/DefaultMetadataResolver.cs
@@ -14,7 +14,7 @@
         private readonly IDictionary<ITypeDescriptor, TypeDefinition> _typeCache;
         private readonly SignatureComparer _comparer = new()
         {
-            AcceptNewerAssemblyVersionNumbers = true
+            IgnoreAssemblyVersionNumbers = true
         };

         /// <summary>


Cleanup BMPEncoder

Cleanup BMPEncoder

--- src/Atlas.Drawing/Serialization/BMP/BMPEncoder.cs
+++ src/Atlas.Drawing/Serialization/BMP/BMPEncoder.cs
@@ -1,9 +1,4 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Threading.Tasks;
-
-namespace Atlas.Drawing.Serialization.BMP
+namespace Atlas.Drawing.Serialization.BMP
 {
     public class BMPEncoder
     {


Removed backface contacts.

Removed backface contacts.

--- BepuPhysics/CollisionDetection/CollisionTasks/BoxTriangleCollisionTask.cs
+++ BepuPhysics/CollisionDetection/CollisionTasks/BoxTriangleCollisionTask.cs
@@ -321,9 +321,11 @@
             //Test face normal of B.
             Vector3Wide.CrossWithoutOverlap(ab, ca, out var triangleNormal);
             Vector3Wide.Length(triangleNormal, out var triangleNormalLength);
-            Vector3Wide.Scale(triangleNormal, Vector<float>.One / triangleNormalLength, out triangleNormal);
-            //Note that we do not calibrate the triangle normal. The backside of the triangle does not collide, so any normal that ends up pointing that direction will be ignored anyway.
             Vector3Wide.Dot(triangleNormal, localTriangleCenter, out var trianglePlaneOffset);
+            var negativeOne = new Vector<float>(-1f);
+            //Calibrate the normal to point from B to A. This is needed because the choice to eliminate backface contacts depends on dot(localNormal, triangleNormal).
+            Vector3Wide.Scale(triangleNormal,
+                Vector.ConditionalSelect(Vector.GreaterThan(trianglePlaneOffset, Vector<float>.Zero), negativeOne, Vector<float>.One) / triangleNormalLength, out triangleNormal);
             var triangleFaceDepth =
                 Vector.Abs(triangleNormal.X) * a.HalfWidth + Vector.Abs(triangleNormal.Y) * a.HalfHeight + Vector.Abs(triangleNormal.Z) * a.HalfLength + trianglePlaneOffset;
             Select(ref depth, ref localNormal, triangleFaceDepth, triangleNormal);
@@ -361,7 +363,6 @@
             boxTangentY.X = Vector<float>.Zero;
             boxTangentY.Y = Vector.ConditionalSelect(Vector.BitwiseOr(useAX, useAZ), Vector<float>.One, Vector<float>.Zero);
             boxTangentY.Z = Vector.ConditionalSelect(useAY, Vector<float>.One, Vector<float>.Zero);
-            var negativeOne = new Vector<float>(-1f);
             boxFaceNormal.X = Vector.ConditionalSelect(useAX, Vector.ConditionalSelect(normalIsNegativeX, Vector<float>.One, negativeOne), Vector<float>.Zero);
             boxFaceNormal.Y = Vector.ConditionalSelect(useAY, Vector.ConditionalSelect(normalIsNegativeY, Vector<float>.One, negativeOne), Vector<float>.Zero);
             boxFaceNormal.Z = Vector.ConditionalSelect(useAZ, Vector.ConditionalSelect(normalIsNegativeZ, Vector<float>.One, negativeOne), Vector<float>.Zero);
@@ -448,6 +449,13 @@
             Matrix3x3Wide.TransformWithoutOverlap(triangleTangentY, worldRA, out var worldTangentBY);
             Matrix3x3Wide.TransformWithoutOverlap(localTriangleCenter, worldRA, out var worldTriangleCenter);
             Matrix3x3Wide.TransformWithoutOverlap(localNormal, worldRA, out manifold.Normal);
+            //If the local normal points against the triangle normal, then it's on the backside and should not collide.
+            Vector3Wide.Dot(localNormal, triangleNormal, out var normalDot);
+            var allowContacts = Vector.GreaterThanOrEqual(normalDot, Vector<float>.Zero);
+            manifold.Contact0Exists = Vector.BitwiseAnd(manifold.Contact0Exists, allowContacts);
+            manifold.Contact1Exists = Vector.BitwiseAnd(manifold.Contact1Exists, allowContacts);
+            manifold.Contact2Exists = Vector.BitwiseAnd(manifold.Contact2Exists, allowContacts);
+            manifold.Contact3Exists = Vector.BitwiseAnd(manifold.Contact3Exists, allowContacts);
             TransformContactToManifold(contact0, worldTriangleCenter, worldTangentBX, worldTangentBY, minimumAcceptedDepth, ref manifold.Contact0Exists, out manifold.OffsetA0, out manifold.Depth0, out manifold.FeatureId0);
             TransformContactToManifold(contact1, worldTriangleCenter, worldTangentBX, worldTangentBY, minimumAcceptedDepth, ref manifold.Contact1Exists, out manifold.OffsetA1, out manifold.Depth1, out manifold.FeatureId1);
             TransformContactToManifold(contact2, worldTriangleCenter, worldTangentBX, worldTangentBY, minimumAcceptedDepth, ref manifold.Contact2Exists, out manifold.OffsetA2, out manifold.Depth2, out manifold.FeatureId2);


Fixed accessibility problem with constructor of FacetOrFilter.FacetOrRandomAccessDocIdSet class.

--- src/BoboBrowse.Net/Facets/Filter/FacetOrFilter.cs
+++ src/BoboBrowse.Net/Facets/Filter/FacetOrFilter.cs
@@ -100,7 +100,7 @@
 	        private readonly IFacetDataCache _dataCache;
             private readonly int[] _index;

-            FacetOrRandomAccessDocIdSet(IFacetHandler facetHandler, BoboIndexReader reader,
+            internal FacetOrRandomAccessDocIdSet(IFacetHandler facetHandler, BoboIndexReader reader,
                 string[] vals, IFacetValueConverter valConverter, bool takeCompliment)
             {
 		        _dataCache = facetHandler.GetFacetData<IFacetDataCache>(reader);


GeneticAlgorithm docs.

GeneticAlgorithm docs.

--- Localwire.Graphinder.Core/Algorithms/GeneticAlgorithm/GeneticAlgorithm.cs
+++ Localwire.Graphinder.Core/Algorithms/GeneticAlgorithm/GeneticAlgorithm.cs
@@ -5,10 +5,20 @@
     using Problems;
     using Setup;

+    /// <summary>
+    /// Represents genetic algorithm that bases on graph data structure.
+    /// </summary>
     public class GeneticAlgorithm : Algorithm
     {
+        /// <summary>
+        /// Creates instance of genetic algorithm
+        /// </summary>
+        /// <param name="graph">Graph on which algorithm will operate</param>
+        /// <param name="problem">Problem for which algorithm will attempt to find solution</param>
+        /// <param name="geneticOperators">Genetic operators used for breeding new generations</param>
+        /// <param name="settings">General settings for solution finding process</param>
         public GeneticAlgorithm(Graph graph, IProblem problem,
-            GeneticOperators geneticOperators, uint populationSize = 50) : base(graph, problem)
+            GeneticOperators geneticOperators, GeneticAlgorithmSettings settings) : base(graph, problem)
         {
             throw new System.NotImplementedException();
         }


AggressiveInlining AsBytes and NonPortableCast (#10057)

--- src/mscorlib/src/System/Span.cs
+++ src/mscorlib/src/System/Span.cs
@@ -426,6 +426,7 @@
         /// <exception cref="System.ArgumentException">
         /// Thrown when <typeparamref name="T"/> contains pointers.
         /// </exception>
+        [MethodImpl(MethodImplOptions.AggressiveInlining)]
         public static Span<byte> AsBytes<T>(this Span<T> source)
             where T : struct
         {
@@ -445,6 +446,7 @@
         /// <exception cref="System.ArgumentException">
         /// Thrown when <typeparamref name="T"/> contains pointers.
         /// </exception>
+        [MethodImpl(MethodImplOptions.AggressiveInlining)]
         public static ReadOnlySpan<byte> AsBytes<T>(this ReadOnlySpan<T> source)
             where T : struct
         {
@@ -467,6 +469,7 @@
         /// <exception cref="System.ArgumentException">
         /// Thrown when <typeparamref name="TFrom"/> or <typeparamref name="TTo"/> contains pointers.
         /// </exception>
+        [MethodImpl(MethodImplOptions.AggressiveInlining)]
         public static Span<TTo> NonPortableCast<TFrom, TTo>(this Span<TFrom> source)
             where TFrom : struct
             where TTo : struct
@@ -492,6 +495,7 @@
         /// <exception cref="System.ArgumentException">
         /// Thrown when <typeparamref name="TFrom"/> or <typeparamref name="TTo"/> contains pointers.
         /// </exception>
+        [MethodImpl(MethodImplOptions.AggressiveInlining)]
         public static ReadOnlySpan<TTo> NonPortableCast<TFrom, TTo>(this ReadOnlySpan<TFrom> source)
             where TFrom : struct
             where TTo : struct