Add test demonstrating issue is fixed.

Add test demonstrating issue is fixed.

--- src/EditorFeatures/CSharpTest/CodeActions/IntroduceVariable/IntroduceVariableTests.cs
+++ src/EditorFeatures/CSharpTest/CodeActions/IntroduceVariable/IntroduceVariableTests.cs
@@ -7328,5 +7328,43 @@
     }
 }", index: 1, options: ImplicitTypingEverywhere());
         }
+
+        [WorkItem(12591, "https://github.com/dotnet/roslyn/issues/12591")]
+        [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsIntroduceVariable)]
+        public async Task TestWhitespaceSelection1()
+        {
+            await TestInRegularAndScriptAsync(
+@"public class Class1
+{
+    void M()
+    {
+        Foo(1,[| Bar()|]);
+    }
+
+    private void Foo(int v1, object v2)
+    {
+    }
+
+    private object Bar()
+    {
+    }
+}",
+@"public class Class1
+{
+    void M()
+    {
+        object {|Rename:v2|} = Bar();
+        Foo(1, v2);
+    }
+
+    private void Foo(int v1, object v2)
+    {
+    }
+
+    private object Bar()
+    {
+    }
+}");
+        }
     }
 }


Add explanatory comments

Add explanatory comments

--- src/Features/CSharp/Portable/Completion/CompletionProviders/CrefCompletionProvider.cs
+++ src/Features/CSharp/Portable/Completion/CompletionProviders/CrefCompletionProvider.cs
@@ -42,7 +42,10 @@
                     SymbolDisplayMiscellaneousOptions.EscapeKeywordIdentifiers |
                     SymbolDisplayMiscellaneousOptions.UseSpecialTypes);

-        public static readonly SymbolDisplayFormat SpecialTypeCrefFormat =
+        // When creating items for SpecialTypes (eg. `UInt32`), create an item
+        // that uses the intrinsic type keyword and an item that uses the
+        // name of the special type
+        public static readonly SymbolDisplayFormat CrefFormatForSpecialTypes =
             new SymbolDisplayFormat(
                 globalNamespaceStyle: SymbolDisplayGlobalNamespaceStyle.Omitted,
                 typeQualificationStyle: SymbolDisplayTypeQualificationStyle.NameOnly,
@@ -278,10 +281,12 @@
             Workspace workspace, SemanticModel semanticModel, ISymbol symbol, SyntaxToken token, int position, StringBuilder builder,
             ImmutableDictionary<string, string> options, out CompletionItem item)
         {
+            // If the type is a SpecialType, create an additional item using
+            // its actual name (as opposed to intrinsic type keyword)
             var typeSymbol = symbol as ITypeSymbol;
             if (typeSymbol.IsSpecialType())
             {
-                item = CreateItem(workspace, semanticModel, symbol, token, position, builder, options, SpecialTypeCrefFormat);
+                item = CreateItem(workspace, semanticModel, symbol, token, position, builder, options, CrefFormatForSpecialTypes);
                 return true;
             }

@@ -292,6 +297,8 @@
         private CompletionItem CreateItem(
             Workspace workspace, SemanticModel semanticModel, ISymbol symbol, SyntaxToken token, int position, StringBuilder builder, ImmutableDictionary<string, string> options)
         {
+            // For every symbol, we create an item that uses the regular CrefFormat,
+            // which uses intrinsic type keywords
             return CreateItem(workspace, semanticModel, symbol, token, position, builder, options, CrefFormat);
         }


Unit test for #2905

Unit test for #2905

--- src/Microsoft.NetCore.Analyzers/UnitTests/Security/DoNotHardCodeEncryptionKeyTests.cs
+++ src/Microsoft.NetCore.Analyzers/UnitTests/Security/DoNotHardCodeEncryptionKeyTests.cs
@@ -403,6 +403,26 @@
         }

         [Fact]
+        public void Test_HardcodedInByteArray_AesKey_Diagnostic()
+        {
+            VerifyCSharp(@"
+using System;
+using System.Security.Cryptography;
+
+class TestClass
+{
+    public void TestMethod()
+    {
+        using (var aes = Aes.Create())
+        {
+            aes.Key = new Byte[] { 1, 2, 3 };
+        }
+    }
+}",
+            GetCSharpResultAt(11, 9, 9, 25, "byte[] SymmetricAlgorithm.Key", "void TestClass.TestMethod()", "byte[]", "void TestClass.TestMethod()"));
+        }
+
+        [Fact]
         public void Test_HardcodedInByteArray_CreateEncryptor_Multivalues_Diagnostic()
         {
             VerifyCSharp(@"


update

update

--- src/Microsoft.NetCore.Analyzers/UnitTests/Security/UseXmlReaderForDeserializeTests.cs
+++ src/Microsoft.NetCore.Analyzers/UnitTests/Security/UseXmlReaderForDeserializeTests.cs
@@ -23,7 +23,7 @@
         new XmlSerializer(typeof(TestClass)).Deserialize(stream);
     }
 }",
-            GetCSharpResultAt(10, 9, UseXmlReaderForDeserialize.RealRule, "Deserialize"));
+            GetCSharpResultAt(10, 9, UseXmlReaderForDeserialize.RealRule, "XmlSerializer", "Deserialize"));
         }

         [Fact]
@@ -41,7 +41,7 @@
         new XmlSerializer(typeof(TestClass)).Deserialize(textReader);
     }
 }",
-            GetCSharpResultAt(10, 9, UseXmlReaderForDeserialize.RealRule, "Deserialize"));
+            GetCSharpResultAt(10, 9, UseXmlReaderForDeserialize.RealRule, "XmlSerializer", "Deserialize"));
         }

         [Fact]
@@ -59,7 +59,7 @@
         return base.Deserialize(xmlSerializationReader);
     }
 }",
-            GetCSharpResultAt(10, 16, UseXmlReaderForDeserialize.RealRule, "Deserialize"));
+            GetCSharpResultAt(10, 16, UseXmlReaderForDeserialize.RealRule, "XmlSerializer", "Deserialize"));

             VerifyBasic(@"
 Imports System
@@ -72,7 +72,7 @@
         Deserialize = MyBase.Deserialize(xmlSerializationReader)
     End Function
 End Class",
-            GetBasicResultAt(9, 23, UseXmlReaderForDeserialize.RealRule, "Deserialize"));
+            GetBasicResultAt(9, 23, UseXmlReaderForDeserialize.RealRule, "XmlSerializer", "Deserialize"));
         }

         [Fact]
@@ -95,7 +95,7 @@
         Deserialize(xmlSerializationReader);
     }
 }",
-            GetCSharpResultAt(15, 9, UseXmlReaderForDeserialize.RealRule, "Deserialize"));
+            GetCSharpResultAt(15, 9, UseXmlReaderForDeserialize.RealRule, "TestClass", "Deserialize"));

             VerifyBasic(@"
 Imports System
@@ -112,7 +112,7 @@
         Deserialize(xmlSerializationReader)
     End Sub
 End Class",
-            GetBasicResultAt(13, 9, UseXmlReaderForDeserialize.RealRule, "Deserialize"));
+            GetBasicResultAt(13, 9, UseXmlReaderForDeserialize.RealRule, "TestClass", "Deserialize"));
         }

         [Fact]
@@ -143,7 +143,7 @@
         Deserialize(xmlSerializationReader);
     }
 }",
-            GetCSharpResultAt(23, 9, UseXmlReaderForDeserialize.RealRule, "Deserialize"));
+            GetCSharpResultAt(23, 9, UseXmlReaderForDeserialize.RealRule, "SubTestClass", "Deserialize"));
         }

         [Fact]


Remove extension

Remove extension

--- src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Utilities/TaskExtensions.cs
+++ src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Utilities/TaskExtensions.cs
@@ -276,15 +276,6 @@
         }

         public static Task SafeContinueWithFromAsync<TInput>(
-           this Task<TInput> task,
-           Func<Task<TInput>, Task> continuationFunction,
-           CancellationToken cancellationToken,
-           TaskScheduler scheduler)
-        {
-            return task.SafeContinueWithFromAsync(continuationFunction, cancellationToken, TaskContinuationOptions.None, scheduler);
-        }
-
-        public static Task SafeContinueWithFromAsync<TInput>(
             this Task<TInput> task,
             Func<Task<TInput>, Task> continuationFunction,
             CancellationToken cancellationToken,


fix vari composizione mezzi

fix vari composizione mezzi

--- src/backend/SO115App.FakePersistance.ExternalAPI/Composizione/GetComposizioneMezzi.cs
+++ src/backend/SO115App.FakePersistance.ExternalAPI/Composizione/GetComposizioneMezzi.cs
@@ -76,20 +76,20 @@
                         Turno = sq.TurnoAttuale.ToCharArray()[0]
                     }).ToList());

-                    var lstSquadreInRientro = Task.Run(() => lstStatiSquadre.Result.FindAll(s => s.StatoSquadra == Costanti.MezzoInRientro && s.CodMezzo == m.Codice).Select(s => new SquadraSemplice()
+                    var lstSquadreInRientro = Task.Run(() => lstStatiSquadre.Result.Where(s => s.StatoSquadra == Costanti.MezzoInRientro && s.CodMezzo == m.Codice).Select(s => new SquadraSemplice()
                     {
                         Codice = s.IdSquadra,
                         Distaccamento = new Sede(lstSedi.Result.FirstOrDefault(sede => sede?.Codice == s.CodiceSede)?.Descrizione),
                         Nome = s.IdSquadra,
                         Stato = MappaStatoSquadraDaStatoMezzo.MappaStatoComposizione(s.StatoSquadra),
-                        Membri = lstSquadre.Result.FirstOrDefault(sq => sq.Codice.Equals(s.IdSquadra)).Membri.Select(m => new Componente()
+                        Membri = lstSquadre.Result.FirstOrDefault(sq => sq.Codice.Equals(s.IdSquadra))?.Membri.Select(m => new Componente()
                         {
                             CodiceFiscale = m.CodiceFiscale,
                             DescrizioneQualifica = m.Ruolo,
                             Nominativo = $"{m.FirstName} {m.LastName}",
                             Ruolo = m.Ruolo
                         }).ToList(),
-                        Turno = lstSquadre.Result.FirstOrDefault(sq => sq.Codice.Equals(s.IdSquadra)).TurnoAttuale.ToCharArray()[0],
+                        Turno = lstSquadre.Result.FirstOrDefault(sq => sq.Codice.Equals(s.IdSquadra))?.TurnoAttuale.ToCharArray()[0] ?? 'X',
                     }).ToList());

                     m.PreAccoppiato = lstSqPreacc.Result?.Count > 0;


Added DisplayName to VolunteerViewModel to generate user friendly errors.

--- crisischeckin/crisicheckinweb/ViewModels/VolunteerViewModel.cs
+++ crisischeckin/crisicheckinweb/ViewModels/VolunteerViewModel.cs
@@ -1,5 +1,6 @@
 using System;
 using System.Collections.Generic;
+using System.ComponentModel;
 using System.Linq;
 using System.Web;
 using Models;
@@ -12,9 +13,13 @@
         public IEnumerable<Commitment> MyCommitments { get; set; }
         public int RemoveCommitmentId { get; set; }
         public int PersonId { get; set; }
+        [DisplayName("Volunteer for Disaster")]
         public int SelectedDisasterId { get; set; }
+        [DisplayName("Start Date")]
         public DateTime SelectedStartDate { get; set; }
+        [DisplayName("End Date")]
         public DateTime SelectedEndDate { get; set; }
+        [DisplayName("Location")]
         public int VolunteerType { get; set; }
         public IEnumerable<VolunteerType> VolunteerTypes { get; set; }
         public Person Person { get; set; }


Fixed encoding issue

Fixed encoding issue

--- mainline/SuperWebSocket/WebSocketContext.cs
+++ mainline/SuperWebSocket/WebSocketContext.cs
@@ -20,6 +20,11 @@
         public string SecWebSocketKey2 { get { return m_Values[WebSocketConstant.SecWebSocketKey2]; } }
         public byte[] SecWebSocketKey3 { get; set; }

+        public WebSocketContext()
+        {
+            this.Charset = Encoding.UTF8;
+        }
+
         private readonly StringDictionary m_Values = new StringDictionary();

         public string this[string key]


fix a test

fix a test

--- test/UnitTests/RequestUrlTests.cs
+++ test/UnitTests/RequestUrlTests.cs
@@ -26,7 +26,7 @@
             var request = new RequestUrl("http://server/authorize");

             var values = new Dictionary<string, string>();
-            var url = request.Create(null);
+            var url = request.Create(values);

             url.Should().Be("http://server/authorize");
         }


Preserve image if it already has transparency (BL-10972) ...as opposed to making all of the white pixels transparent.

--- src/BloomExe/ImageProcessing/RuntimeImageProcessor.cs
+++ src/BloomExe/ImageProcessing/RuntimeImageProcessor.cs
@@ -274,7 +274,7 @@

 					lock(ConvertWhiteToTransparent)
 					{
-						var imageAttributes = appearsToBeJpeg ? null : ConvertWhiteToTransparent;
+						var imageAttributes = appearsToBeJpeg || ImageUtils.HasTransparency(coverImage.Image) ? null : ConvertWhiteToTransparent;
 						g.DrawImage(
 							coverImage.Image, // finally, draw the cover image
 							destRect, // with a scaled and centered destination
@@ -307,6 +307,9 @@
 		}
 		public static Image MakePngBackgroundTransparent(PalasoImage originalImage)
 		{
+			if (ImageUtils.HasTransparency(originalImage.Image))
+				return originalImage.Image.Clone() as Image;
+
 			// If the image is indexed and opaque, convert the palette to have a transparent background.  This produces
 			// a much smaller image file than the process of redrawing the image with a transparent conversion.  That
 			// process always produces a 32-bit RGBA format image.  Changing the palette should also be faster than


Workaround for GetConstructor failed

Workaround for GetConstructor failed


Added webhook to PaymentSpecificParameters (#165)

--- Mollie.Api/Models/Order/Request/PaymentSpecificParameters/PaymentSpecificParameters.cs
+++ Mollie.Api/Models/Order/Request/PaymentSpecificParameters/PaymentSpecificParameters.cs
@@ -4,5 +4,6 @@
     public class PaymentSpecificParameters {
         public string CustomerId { get; set; }
         public SequenceType SequenceType { get; set; }
+        public string WebhookUrl { get; set; }
     }
 }


Changed test to not use SqlHelper.

Changed test to not use SqlHelper.

--- SubtextSolution/UnitTests.Subtext/Framework/Components/MetaTagTests/MetaTagGetTests.cs
+++ SubtextSolution/UnitTests.Subtext/Framework/Components/MetaTagTests/MetaTagGetTests.cs
@@ -15,14 +15,9 @@

 using System;
 using System.Collections.Generic;
-using System.Data;
-using System.Data.SqlClient;
 using MbUnit.Framework;
-using Microsoft.ApplicationBlocks.Data;
 using Subtext.Framework;
 using Subtext.Framework.Components;
-using Subtext.Framework.Configuration;
-using Subtext.Framework.Data;

 namespace UnitTests.Subtext.Framework.Components.MetaTagTests
 {
@@ -90,23 +85,15 @@

         #region Some helper code to populate the db w/metatags

-        private static readonly string insertSql = @"INSERT INTO subtext_MetaTag ([Content], [Name], HttpEquiv, DateCreated, BlogId, EntryId) VALUES (@Content, @Name, @HttpEquiv, @DateCreated, @BlogId, @EntryId)";
-
-
-        private void InsertNewMetaTag(string content, string nameValue, string httpEquivValue, DateTime created, int blogId, int? entryId)
+        private static void InsertNewMetaTag(string content, string nameValue, string httpEquivValue, DateTime created, int blogId, int? entryId)
         {
-            object entryIdValue = entryId.HasValue ? DataHelper.CheckNull(entryId.Value) : DBNull.Value;
-
-            SqlParameter[] p =
-                {
-                    DataHelper.MakeInParam("@Content", content),
-                    DataHelper.MakeInParam("@Name", DataHelper.CheckNull(nameValue)),
-                    DataHelper.MakeInParam("@HttpEquiv", DataHelper.CheckNull(httpEquivValue)),
-                    DataHelper.MakeInParam("@DateCreated", created),
-                    DataHelper.MakeInParam("@BlogId", blogId),
-                    DataHelper.MakeInParam("@EntryId", SqlDbType.Int, 4, entryIdValue)
-                };
-            SqlHelper.ExecuteNonQuery(Config.ConnectionString, CommandType.Text, insertSql, p);
+        	MetaTag tag = new MetaTag();
+        	tag.Content = content;
+        	tag.Name = nameValue;
+        	tag.HttpEquiv = httpEquivValue;
+        	tag.DateCreated = created;
+        	tag.EntryId = entryId;
+        	MetaTags.Create(tag);
         }

         #endregion


Ignore rather than comments

Ignore rather than comments

--- VotingApplication/VotingApplication.Web.Tests/Controllers/PollResultControllerTests.cs
+++ VotingApplication/VotingApplication.Web.Tests/Controllers/PollResultControllerTests.cs
@@ -157,32 +157,32 @@
                 Assert.IsTrue(voters.All(v => v.Name != null));
             }

-            // Election mode tests not needed right now
-            //[TestMethod]
-            //[ExpectedHttpResponseException(HttpStatusCode.BadRequest)]
-            //public void ElectionPoll_WithNoVotes_ThrowsBadRequest()
-            //{
-
-            //    IDbSet<Poll> polls = DbSetTestHelper.CreateMockDbSet<Poll>();
-            //    var poll = new Poll()
-            //    {
-            //        UUID = PollManageGuid,
-            //        ElectionMode = true
-            //    };
-            //    polls.Add(poll);
-
-            //    IDbSet<Choice> choices = DbSetTestHelper.CreateMockDbSet<Choice>();
-            //    var option1 = new Choice() { PollChoiceNumber = 1 };
-            //    var option2 = new Choice() { PollChoiceNumber = 2 };
-            //    choices.Add(option1);
-            //    choices.Add(option2);
-
-            //    IContextFactory contextFactory = ContextFactoryTestHelper.CreateContextFactory(polls, choices);
-
-            //    PollResultsController controller = CreatePollController(contextFactory);
-
-            //    controller.Get(PollManageGuid);
-            //}
+            [Ignore]
+            [TestMethod]
+            [ExpectedHttpResponseException(HttpStatusCode.BadRequest)]
+            public void ElectionPoll_WithNoVotes_ThrowsBadRequest()
+            {
+
+                IDbSet<Poll> polls = DbSetTestHelper.CreateMockDbSet<Poll>();
+                var poll = new Poll()
+                {
+                    UUID = PollManageGuid,
+                    ElectionMode = true
+                };
+                polls.Add(poll);
+
+                IDbSet<Choice> choices = DbSetTestHelper.CreateMockDbSet<Choice>();
+                var option1 = new Choice() { PollChoiceNumber = 1 };
+                var option2 = new Choice() { PollChoiceNumber = 2 };
+                choices.Add(option1);
+                choices.Add(option2);
+
+                IContextFactory contextFactory = ContextFactoryTestHelper.CreateContextFactory(polls, choices);
+
+                PollResultsController controller = CreatePollController(contextFactory);
+
+                controller.Get(PollManageGuid);
+            }

             [TestMethod]
             public void NamedVoting_True_WithPreviousAnonymousVotes_ReturnsAnonymousVoterForUnNamedVoters()
@@ -447,21 +447,21 @@
                 controller.Get(PollId);
             }

-            // Election mode tests not needed right now
-            //[TestMethod]
-            //[ExpectedHttpResponseException(HttpStatusCode.NotFound)]
-            //public void NonInviteOnly_XTokenGuidHeader_BallotNotInPoll_ThrowsNotFound()
-            //{
-            //    IDbSet<Poll> polls = DbSetTestHelper.CreateMockDbSet<Poll>();
-            //    polls.Add(CreateNonInviteOnlyPoll());
-            //    IContextFactory contextFactory = ContextFactoryTestHelper.CreateContextFactory(polls);
-
-            //    PollResultsController controller = CreatePollController(contextFactory);
-            //    AddXTokenGuidHeader(controller, TokenGuid);
-
-
-            //    controller.Get(PollId);
-            //}
+            [Ignore]
+            [TestMethod]
+            [ExpectedHttpResponseException(HttpStatusCode.NotFound)]
+            public void NonInviteOnly_XTokenGuidHeader_BallotNotInPoll_ThrowsNotFound()
+            {
+                IDbSet<Poll> polls = DbSetTestHelper.CreateMockDbSet<Poll>();
+                polls.Add(CreateNonInviteOnlyPoll());
+                IContextFactory contextFactory = ContextFactoryTestHelper.CreateContextFactory(polls);
+
+                PollResultsController controller = CreatePollController(contextFactory);
+                AddXTokenGuidHeader(controller, TokenGuid);
+
+
+                controller.Get(PollId);
+            }

             [TestMethod]
             [ExpectedHttpResponseException(HttpStatusCode.Unauthorized)]


Implement slider control point deletion

Implement slider control point deletion

--- osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/Components/PathControlPointVisualiser.cs
+++ osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/Components/PathControlPointVisualiser.cs
@@ -2,12 +2,16 @@
 // See the LICENCE file in the repository root for full licence text.

 using System;
+using System.Collections.Generic;
+using osu.Framework.Allocation;
 using osu.Framework.Graphics;
 using osu.Framework.Graphics.Containers;
 using osu.Framework.Input;
 using osu.Framework.Input.Events;
 using osu.Game.Rulesets.Osu.Objects;
+using osu.Game.Screens.Edit.Compose;
 using osuTK;
+using osuTK.Input;

 namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders.Components
 {
@@ -19,6 +23,9 @@
         private readonly Slider slider;

         private InputManager inputManager;
+
+        [Resolved(CanBeNull = true)]
+        private IPlacementHandler placementHandler { get; set; }

         public PathControlPointVisualiser(Slider slider)
         {
@@ -70,5 +77,44 @@
                     piece.IsSelected.Value = piece.Index == index;
             }
         }
+
+        protected override bool OnKeyDown(KeyDownEvent e)
+        {
+            switch (e.Key)
+            {
+                case Key.Delete:
+                    var newControlPoints = new List<Vector2>();
+
+                    foreach (var piece in pieces)
+                    {
+                        if (!piece.IsSelected.Value)
+                            newControlPoints.Add(slider.Path.ControlPoints[piece.Index]);
+                    }
+
+                    // Ensure that there are any points to be deleted
+                    if (newControlPoints.Count == slider.Path.ControlPoints.Length)
+                        return false;
+
+                    // If there are 0 remaining control points, treat the slider as being deleted
+                    if (newControlPoints.Count == 0)
+                    {
+                        placementHandler?.Delete(slider);
+                        return true;
+                    }
+
+                    // Make control points relative
+                    Vector2 first = newControlPoints[0];
+                    for (int i = 0; i < newControlPoints.Count; i++)
+                        newControlPoints[i] = newControlPoints[i] - first;
+
+                    // The slider's position defines the position of the first control point, and all further control points are relative to that point
+                    slider.Position = slider.Position + first;
+                    ControlPointsChanged?.Invoke(newControlPoints.ToArray());
+
+                    return true;
+            }
+
+            return false;
+        }
     }
 }


Move public method up and add xmldoc to second public method

--- osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/Components/PathControlPointVisualiser.cs
+++ osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/Components/PathControlPointVisualiser.cs
@@ -69,6 +69,39 @@
             controlPoints.BindTo(slider.Path.ControlPoints);
         }

+        /// <summary>
+        /// Selects the <see cref="PathControlPointPiece"/> corresponding to the given <paramref name="pathControlPoint"/>,
+        /// and deselects all other <see cref="PathControlPointPiece"/>s.
+        /// </summary>
+        public void SetSelectionTo(PathControlPoint pathControlPoint)
+        {
+            foreach (var p in Pieces)
+                p.IsSelected.Value = p.ControlPoint == pathControlPoint;
+        }
+
+        /// <summary>
+        /// Delete all visually selected <see cref="PathControlPoint"/>s.
+        /// </summary>
+        /// <returns></returns>
+        public bool DeleteSelected()
+        {
+            List<PathControlPoint> toRemove = Pieces.Where(p => p.IsSelected.Value).Select(p => p.ControlPoint).ToList();
+
+            // Ensure that there are any points to be deleted
+            if (toRemove.Count == 0)
+                return false;
+
+            changeHandler?.BeginChange();
+            RemoveControlPointsRequested?.Invoke(toRemove);
+            changeHandler?.EndChange();
+
+            // Since pieces are re-used, they will not point to the deleted control points while remaining selected
+            foreach (var piece in Pieces)
+                piece.IsSelected.Value = false;
+
+            return true;
+        }
+
         private void onControlPointsChanged(object sender, NotifyCollectionChangedEventArgs e)
         {
             switch (e.Action)
@@ -160,16 +193,6 @@
                 piece.IsSelected.Toggle();
             else
                 SetSelectionTo(piece.ControlPoint);
-        }
-
-        /// <summary>
-        /// Selects the <see cref="PathControlPointPiece"/> corresponding to the given <paramref name="pathControlPoint"/>,
-        /// and deselects all other <see cref="PathControlPointPiece"/>s.
-        /// </summary>
-        public void SetSelectionTo(PathControlPoint pathControlPoint)
-        {
-            foreach (var p in Pieces)
-                p.IsSelected.Value = p.ControlPoint == pathControlPoint;
         }

         /// <summary>
@@ -202,25 +225,6 @@

         [Resolved(CanBeNull = true)]
         private IEditorChangeHandler changeHandler { get; set; }
-
-        public bool DeleteSelected()
-        {
-            List<PathControlPoint> toRemove = Pieces.Where(p => p.IsSelected.Value).Select(p => p.ControlPoint).ToList();
-
-            // Ensure that there are any points to be deleted
-            if (toRemove.Count == 0)
-                return false;
-
-            changeHandler?.BeginChange();
-            RemoveControlPointsRequested?.Invoke(toRemove);
-            changeHandler?.EndChange();
-
-            // Since pieces are re-used, they will not point to the deleted control points while remaining selected
-            foreach (var piece in Pieces)
-                piece.IsSelected.Value = false;
-
-            return true;
-        }

         #region Drag handling


fix(clients): 🐛 fix baseuri for IDirectoryClient

--- services/SharedKernel/FilterLists.SharedKernel.Apis.Clients/ConfigurationExtensions.cs
+++ services/SharedKernel/FilterLists.SharedKernel.Apis.Clients/ConfigurationExtensions.cs
@@ -9,7 +9,7 @@
         public static void AddApiClients(this IServiceCollection services)
         {
             services.AddRefitClient<IDirectoryApi>()
-                .ConfigureHttpClient(c => c.BaseAddress = new Uri("http://directory-api/api"));
+                .ConfigureHttpClient(c => c.BaseAddress = new Uri("http://directory-api"));
         }
     }
 }


Added support for TableName on AWS legacy configurator (#4983)

--- src/AWS/Orleans.Clustering.DynamoDB/Membership/LegacyDynamoDBMembershipConfigurator.cs
+++ src/AWS/Orleans.Clustering.DynamoDB/Membership/LegacyDynamoDBMembershipConfigurator.cs
@@ -13,6 +13,7 @@
         private const string AccessKeyPropertyName = "AccessKey";
         private const string SecretKeyPropertyName = "SecretKey";
         private const string ServicePropertyName = "Service";
+        private const string TableNamePropertyName = "TableName";
         private const string ReadCapacityUnitsPropertyName = "ReadCapacityUnits";
         private const string WriteCapacityUnitsPropertyName = "WriteCapacityUnits";

@@ -42,6 +43,14 @@
                 var value = serviceConfig.Split(new[] { '=' }, StringSplitOptions.RemoveEmptyEntries);
                 if (value.Length == 2 && !string.IsNullOrWhiteSpace(value[1]))
                     options.Service = value[1];
+            }
+
+            var tableNameConfig = parameters.Where(p => p.Contains(TableNamePropertyName)).FirstOrDefault();
+            if (!string.IsNullOrWhiteSpace(tableNameConfig))
+            {
+                var value = tableNameConfig.Split(new[] { '=' }, StringSplitOptions.RemoveEmptyEntries);
+                if (value.Length == 2 && !string.IsNullOrWhiteSpace(value[1]))
+                    options.TableName = value[1];
             }

             var secretKeyConfig = parameters.Where(p => p.Contains(SecretKeyPropertyName)).FirstOrDefault();


Fix: Missing void end tag when targeted by TH with WithoutEndTag structure (dotnet/aspnetcore-tooling#105)

\n\nCommit migrated from https://github.com/dotnet/aspnetcore-tooling/commit/33bf2691d5a58e9a071b9774c3867d8c5120cf4a

--- src/Razor/Microsoft.AspNetCore.Razor.Language/src/Legacy/TagHelperParseTreeRewriter.cs
+++ src/Razor/Microsoft.AspNetCore.Razor.Language/src/Legacy/TagHelperParseTreeRewriter.cs
@@ -111,18 +111,18 @@
                         {
                             var tagHelperElement = SyntaxFactory.MarkupTagHelperElement(tagHelperStart, body: new SyntaxList<RazorSyntaxNode>(), endTag: null);
                             var rewrittenTagHelper = tagHelperElement.WithTagHelperInfo(tagHelperInfo);
-                            if (node.Body.Count == 0)
+                            if (node.Body.Count == 0 && node.EndTag == null)
                             {
                                 return rewrittenTagHelper;
                             }

-                            // This tag contains a body which needs to be moved to the parent.
+                            // This tag contains a body and/or an end tag which needs to be moved to the parent.
                             var rewrittenNodes = SyntaxListBuilder<RazorSyntaxNode>.Create();
                             rewrittenNodes.Add(rewrittenTagHelper);
                             var rewrittenBody = VisitList(node.Body);
                             rewrittenNodes.AddRange(rewrittenBody);

-                            return SyntaxFactory.MarkupElement(startTag: null, body: rewrittenNodes.ToList(), endTag: null);
+                            return SyntaxFactory.MarkupElement(startTag: null, body: rewrittenNodes.ToList(), endTag: node.EndTag);
                         }
                         else if (node.EndTag == null)
                         {


Moved 'before you start' higher up the page

--- src/SFA.DAS.EmployerApprenticeshipsService.Web/Views/EmployerCommitments/Inform.cshtml
+++ src/SFA.DAS.EmployerApprenticeshipsService.Web/Views/EmployerCommitments/Inform.cshtml
@@ -22,21 +22,21 @@

the UK Provider Reference Number (UKPRN) of your training provider

         What is a UKPRN?
-

+

What is a UKPRN?

A UK Provider Reference Number (UKPRN) is a unique number that identifies an individual training provider. Your training provider will be able to tell you their UKPRN.

-
Once you start, you can choose to add details of each apprentice or allow your training provider to add details for you.

-        <form action="@Url.Action("SelectLegalEntity")" method="GET">
-            <input type="hidden" name="accountId" value="@Model.AccountId"/>
-            <button type="submit" name="commitment" class="button">Start</button>
-        </form>
-
Before you start

+
Before you start

You will need:

an employer agreement with the Skills Funding Agency

a training contract with your training provider

the names of your apprentices

+
Once you start, you can choose to add details of each apprentice or allow your training provider to add details for you.

+        <form action="@Url.Action("SelectLegalEntity")" method="GET">
+            <input type="hidden" name="accountId" value="@Model.AccountId"/>
+            <button type="submit" name="commitment" class="button">Start</button>
+        </form>


CON-2153 Remove commented default registry code

--- src/SFA.DAS.ProviderApprenticeshipsService.Web/DependencyResolution/DefaultRegistry.cs
+++ src/SFA.DAS.ProviderApprenticeshipsService.Web/DependencyResolution/DefaultRegistry.cs
@@ -94,9 +94,6 @@
             For<IProviderAgreementStatusConfiguration>().Use(config);
             For<ProviderApprenticeshipsServiceConfiguration>().Use(config);

-            //For<IContentApiConfiguration>().Use(config.ContentApi);
-            //For<IContentApiClient>().Use<ContentApiClient>().Ctor<HttpClient>().Is(c => CreateClient(c, config));
-
             For<ICache>().Use<InMemoryCache>(); //RedisCache
             For<IAgreementStatusQueryRepository>().Use<ProviderAgreementStatusRepository>();
             For<IApprenticeshipValidationErrorText>().Use<WebApprenticeshipValidationText>();
@@ -235,21 +232,5 @@

             return result;
         }
-
-
-        //private HttpClient CreateClient(IContext context, ProviderApprenticeshipsServiceConfiguration providerApprenticeshipsServiceConfiguration)
-        //{
-        //    var config = providerApprenticeshipsServiceConfiguration.ContentApi;
-
-        //    HttpClient httpClient = new HttpClientBuilder()
-        //            .WithBearerAuthorisationHeader(new AzureActiveDirectoryBearerTokenGenerator(config))
-        //            .WithHandler(new RequestIdMessageRequestHandler())
-        //            .WithHandler(new SessionIdMessageRequestHandler())
-        //            .WithDefaultHeaders()
-        //            .Build();
-
-
-        //    return httpClient;
-        //}
     }
 }


Support ContainerElementStyle.VerticalPadding in integration tests

--- src/VisualStudio/IntegrationTest/TestUtilities/InProcess/QuickInfoToStringConverter.cs
+++ src/VisualStudio/IntegrationTest/TestUtilities/InProcess/QuickInfoToStringConverter.cs
@@ -29,7 +29,23 @@
                 case ITextBuffer textBuffer:
                     return textBuffer.CurrentSnapshot.GetText();
                 case ContainerElement containerElement:
-                    var separator = containerElement.Style == ContainerElementStyle.Wrapped ? "" : Environment.NewLine;
+                    string separator;
+                    switch (containerElement.Style)
+                    {
+                        case ContainerElementStyle.Wrapped:
+                            separator = "";
+                            break;
+
+                        case ContainerElementStyle.Stacked | ContainerElementStyle.VerticalPadding:
+                            separator = Environment.NewLine + Environment.NewLine;
+                            break;
+
+                        case ContainerElementStyle.Stacked:
+                        default:
+                            separator = Environment.NewLine;
+                            break;
+                    }
+
                     return string.Join(separator, containerElement.Elements.Select(GetStringFromItem));
                 case ClassifiedTextElement classifiedTextElement:
                     return string.Join("", classifiedTextElement.Runs.Select(GetStringFromItem));


revise init changes

revise init changes

--- Assets/MRTK/Providers/WindowsMixedReality/Shared/WindowsMixedRealityHandMeshProvider.cs
+++ Assets/MRTK/Providers/WindowsMixedReality/Shared/WindowsMixedRealityHandMeshProvider.cs
@@ -25,16 +25,16 @@

         private WindowsMixedRealityHandMeshProvider(Handedness handedness)
         {
-            Handedness = handedness;
-            Controller = null;
+            this.handedness = handedness;
+            controller = null;
         }

         [Obsolete("WindowsMixedRealityHandMeshProvider(IMixedRealityController) is obsolete. Please use either the static LeftHand or RightHand members and call SetController()")]
-        public WindowsMixedRealityHandMeshProvider(IMixedRealityController controller) => this.Controller = controller;
-
-        private IMixedRealityController Controller = null;
-        private IMixedRealityInputSource InputSource => Controller.InputSource;
-        private Handedness Handedness;
+        public WindowsMixedRealityHandMeshProvider(IMixedRealityController controller) => this.controller = controller;
+
+        private IMixedRealityController controller = null;
+        private IMixedRealityInputSource InputSource => controller.InputSource;
+        private Handedness handedness;

         /// <summary>
         /// Sets the <see cref="IMixedRealityController"/> that provides data for the hand mesh.
@@ -42,14 +42,19 @@
         /// <param name="controller">Implementation of the hand controller.</param>
         public void SetController(IMixedRealityController controller)
         {
-            if (controller.ControllerHandedness != Handedness)
-            {
-                Debug.LogError($"Attempted to set controller with the wrong handedness (exected: {Handedness} actual:{controller.ControllerHandedness}");
-            }
+            if (controller.ControllerHandedness != handedness)
+            {
+                Debug.LogError($"Attempted to set controller with the wrong handedness (exected: {handedness} actual:{controller.ControllerHandedness}");
+            }
+
+            this.controller = controller;
         }

 #if WINDOWS_UWP
         private HandMeshObserver handMeshObserver = null;
+
+        private static int handMeshModelId = -1;
+        private static int neutralPoseVersion = -1;

         private ushort[] handMeshTriangleIndices = null;
         private HandMeshVertex[] vertexAndNormals = null;
@@ -126,7 +131,7 @@
                     {
                         // Notify that hand mesh has been updated (cleared)
                         HandMeshInfo handMeshInfo = new HandMeshInfo();
-                        CoreServices.InputSystem?.RaiseHandMeshUpdated(InputSource, Handedness, handMeshInfo);
+                        CoreServices.InputSystem?.RaiseHandMeshUpdated(InputSource, handedness, handMeshInfo);
                         hasRequestedHandMeshObserver = false;
                         handMeshObserver = null;
                     }
@@ -142,16 +147,27 @@
                     hasRequestedHandMeshObserver = true;
                 }

+                uint triangleIndexCount = handMeshObserver.TriangleIndexCount;
                 if (handMeshObserver != null && handPose != null)
                 {
-                    if (handMeshTriangleIndices == null)
-                    {
-                        handMeshTriangleIndices = new ushort[handMeshObserver.TriangleIndexCount];
-                        handMeshTriangleIndicesUnity = new int[handMeshObserver.TriangleIndexCount];
+                    if ((handMeshTriangleIndices == null) ||
+                        (handMeshTriangleIndices.Length != triangleIndexCount))
+                    {
+                        handMeshTriangleIndices = new ushort[triangleIndexCount];
+                        handMeshTriangleIndicesUnity = new int[triangleIndexCount];
+                    }
+
+                    int modelId = handMeshObserver.ModelId;
+                    if (handMeshModelId != modelId)
+                    {
                         handMeshObserver.GetTriangleIndices(handMeshTriangleIndices);
-
+                        handMeshModelId = modelId;
                         Array.Copy(handMeshTriangleIndices, handMeshTriangleIndicesUnity, (int)handMeshObserver.TriangleIndexCount);
-
+                    }
+
+                    int poseVersion = handMeshObserver.NeutralPoseVersion;
+                    if (neutralPoseVersion != poseVersion)
+                    {
                         // Compute neutral pose
                         Vector3[] neutralPoseVertices = new Vector3[handMeshObserver.VertexCount];
                         HandPose neutralPose = handMeshObserver.NeutralPose;
@@ -163,6 +179,8 @@
                         {
                             neutralVertexAndNormals[i].Position.ConvertToUnityVector3(ref neutralPoseVertices[i]);
                         });
+
+                        neutralPoseVersion = poseVersion;

                         // Compute UV mapping
                         InitializeUVs(neutralPoseVertices);
@@ -208,7 +226,7 @@
                                 rotation = rotationUnity
                             };

-                            CoreServices.InputSystem?.RaiseHandMeshUpdated(InputSource, Handedness, handMeshInfo);
+                            CoreServices.InputSystem?.RaiseHandMeshUpdated(InputSource, handedness, handMeshInfo);
                         }
                     }
                 }


Replaced default sprite shader with standard unlit particle shader

--- Assets/MixedRealityToolkit.Extensions/SceneTransitionService/Scripts/CameraFaderQuad.cs
+++ Assets/MixedRealityToolkit.Extensions/SceneTransitionService/Scripts/CameraFaderQuad.cs
@@ -13,7 +13,7 @@
     /// </summary>
     public class CameraFaderQuad : ICameraFader
     {
-        const string QuadMaterialShaderName = "Sprites/Default";
+        const string QuadMaterialShaderName = "Particles/Standard Unlit";
         const string QuadMaterialColorName = "_Color";

         /// <summary>
@@ -66,6 +66,15 @@
                 try
                 {
                     quadMaterial = new Material(Shader.Find(QuadMaterialShaderName));
+                    // Set to fade
+                    quadMaterial.SetInt("_Mode", 2);
+                    quadMaterial.SetInt("_SrcBlend", (int)UnityEngine.Rendering.BlendMode.SrcAlpha);
+                    quadMaterial.SetInt("_DstBlend", (int)UnityEngine.Rendering.BlendMode.OneMinusSrcAlpha);
+                    quadMaterial.SetInt("_ZWrite", 0);
+                    quadMaterial.DisableKeyword("_ALPHATEST_ON");
+                    quadMaterial.EnableKeyword("_ALPHABLEND_ON");
+                    quadMaterial.DisableKeyword("_ALPHAPREMULTIPLY_ON");
+                    quadMaterial.renderQueue = 3000;
                 }
                 catch (Exception e)
                 {
@@ -75,6 +84,7 @@
                 }
             }

+            quadMaterial.enableInstancing = true;
             quadMaterial.SetColor(QuadMaterialColorName, currentColor);

             // Create our quads
@@ -192,14 +202,7 @@
             {
                 if (quad.Renderer != null)
                 {
-                    if (Application.isPlaying)
-                    {
-                        GameObject.Destroy(quad.Renderer.gameObject);
-                    }
-                    else
-                    {
-                        GameObject.DestroyImmediate(quad.Renderer.gameObject);
-                    }
+                    GameObjectExtensions.DestroyGameObject(quad.Renderer.gameObject);
                 }
             }


Alpha order  methods (within region)

Alpha order  methods (within region)

--- OfficeDevPnP.Core/OfficeDevPnP.Core/AppModelExtensions/FieldAndContentTypeExtensions.cs
+++ OfficeDevPnP.Core/OfficeDevPnP.Core/AppModelExtensions/FieldAndContentTypeExtensions.cs
@@ -556,6 +556,318 @@
         #endregion

         #region Content Types
+
+        /// <summary>
+        /// Adds content type to list
+        /// </summary>
+        /// <param name="web">Site to be processed - can be root web or sub site</param>
+        /// <param name="listTitle">Title of the list</param>
+        /// <param name="contentTypeID">Complete ID for the content type</param>
+        /// <param name="defaultContent">Optionally make this the default content type</param>
+        public static void AddContentTypeToListById(this Web web, string listTitle, string contentTypeId, bool defaultContent = false)
+        {
+            // Get content type instance
+            ContentType contentType = GetContentTypeById(web, contentTypeId);
+            // Add content type to list
+            AddContentTypeToList(web, listTitle, contentType, defaultContent);
+        }
+
+        /// <summary>
+        /// Adds content type to list
+        /// </summary>
+        /// <param name="web">Site to be processed - can be root web or sub site</param>
+        /// <param name="listTitle">Title of the list</param>
+        /// <param name="contentTypeName">Name of the content type</param>
+        /// <param name="defaultContent">Optionally make this the default content type</param>
+        public static void AddContentTypeToListByName(this Web web, string listTitle, string contentTypeName, bool defaultContent = false)
+        {
+            // Get content type instance
+            ContentType contentType = GetContentTypeByName(web, contentTypeName);
+            // Add content type to list
+            AddContentTypeToList(web, listTitle, contentType, defaultContent);
+        }
+
+        /// <summary>
+        /// Adds content type to list
+        /// </summary>
+        /// <param name="web">Site to be processed - can be root web or sub site</param>
+        /// <param name="listTitle">Title of the list</param>
+        /// <param name="contentType">Content type to be added to the list</param>
+        /// <param name="defaultContent">If set true, content type is updated to be default content type for the list</param>
+        public static void AddContentTypeToList(this Web web, string listTitle, ContentType contentType, bool defaultContent = false)
+        {
+            // Get list instances
+            List list = web.GetListByTitle(listTitle);
+            // Add content type to list
+            AddContentTypeToList(list, contentType, defaultContent);
+        }
+
+        /// <summary>
+        /// Add content type to list
+        /// </summary>
+        /// <param name="list">List to add content type to</param>
+        /// <param name="contentTypeID">Complete ID for the content type</param>
+        /// <param name="defaultContent">If set true, content type is updated to be default content type for the list</param>
+        public static void AddContentTypeToListById(this List list, string contentTypeID, bool defaultContent = false)
+        {
+            Web web = list.ParentWeb;
+            ContentType contentType = GetContentTypeById(web, contentTypeID);
+            AddContentTypeToList(list, contentType, defaultContent);
+        }
+
+        /// <summary>
+        /// Add content type to list
+        /// </summary>
+        /// <param name="list">List to add content type to</param>
+        /// <param name="contentTypeName">Name of the content type</param>
+        /// <param name="defaultContent">If set true, content type is updated to be default content type for the list</param>
+        public static void AddContentTypeToListByName(this List list, string contentTypeName, bool defaultContent = false)
+        {
+            Web web = list.ParentWeb;
+            ContentType contentType = GetContentTypeByName(web, contentTypeName);
+            AddContentTypeToList(list, contentType, defaultContent);
+        }
+
+        /// <summary>
+        /// Add content type to list
+        /// </summary>
+        /// <param name="list">List to add content type to</param>
+        /// <param name="contentType">Content type to add to the list</param>
+        /// <param name="defaultContent">If set true, content type is updated to be default content type for the list</param>
+        public static void AddContentTypeToList(this List list, ContentType contentType, bool defaultContent = false)
+        {
+            if (contentType == null)
+                throw new ArgumentNullException("contentType");
+
+            if (list.ContentTypeExistsById(contentType.Id.StringValue))
+                return;
+
+            list.ContentTypesEnabled = true;
+            list.Update();
+            list.Context.ExecuteQuery();
+
+            list.ContentTypes.AddExistingContentType(contentType);
+            list.Context.ExecuteQuery();
+            //set the default content type
+            if (defaultContent)
+            {
+                SetDefaultContentTypeToList(list, contentType);
+            }
+        }
+
+        /// <summary>
+        /// Associates field to content type
+        /// </summary>
+        /// <param name="web">Site to be processed - can be root web or sub site</param>
+        /// <param name="id">Complete ID for the content type</param>
+        /// <param name="fieldID">String representation of the field ID (=guid)</param>
+        public static void AddFieldToContentTypeById(this Web web, string contentTypeID, string fieldID, bool required = false, bool hidden = false)
+        {
+            // Get content type
+            ContentType ct = web.GetContentTypeById(contentTypeID);
+            web.Context.Load(ct);
+            web.Context.Load(ct.FieldLinks);
+            web.Context.ExecuteQuery();
+
+            // Get field
+            Field fld = web.Fields.GetById(new Guid(fieldID));
+
+            // Add field association to content type
+            AddFieldToContentType(web, ct, fld, required, hidden);
+        }
+
+        /// <summary>
+        /// Associates field to content type
+        /// </summary>
+        /// <param name="web">Site to be processed - can be root web or sub site</param>
+        /// <param name="contentTypeName">Name of the content type</param>
+        /// <param name="fieldID">Guid representation of the field ID</param>
+        public static void AddFieldToContentTypeByName(this Web web, string contentTypeName, Guid fieldID, bool required = false, bool hidden = false)
+        {
+            // Get content type
+            ContentType ct = web.GetContentTypeByName(contentTypeName);
+            web.Context.Load(ct);
+            web.Context.Load(ct.FieldLinks);
+            web.Context.ExecuteQuery();
+
+            // Get field
+            Field fld = web.Fields.GetById(fieldID);
+
+            // Add field association to content type
+            AddFieldToContentType(web, ct, fld, required, hidden);
+        }
+
+        /// <summary>
+        /// Associates field to content type
+        /// </summary>
+        /// <param name="web">Site to be processed - can be root web or sub site</param>
+        /// <param name="contentType">Content type to associate field to</param>
+        /// <param name="field">Field to associate to the content type</param>
+        /// <param name="required">Optionally make this a required field</param>
+        /// <param name="hidden">Optionally make this a hidden field</param>
+        public static void AddFieldToContentType(this Web web, ContentType contentType, Field field, bool required = false, bool hidden = false)
+        {
+            FieldLinkCreationInformation fldInfo = new FieldLinkCreationInformation();
+            fldInfo.Field = field;
+            contentType.FieldLinks.Add(fldInfo);
+            contentType.Update(true);
+            web.Context.ExecuteQuery();
+
+            web.Context.Load(field);
+            web.Context.ExecuteQuery();
+
+            if (required || hidden)
+            {
+                //Update FieldLink
+                FieldLink flink = contentType.FieldLinks.GetById(field.Id);
+                flink.Required = required;
+                flink.Hidden = hidden;
+                contentType.Update(true);
+                web.Context.ExecuteQuery();
+            }
+        }
+
+        /// <summary>
+        /// Does content type exists in the web
+        /// </summary>
+        /// <param name="web">Web to be processed</param>
+        /// <param name="contentTypeID">Complete ID for the content type</param>
+        /// <returns>True if the content type exists, false otherwise</returns>
+        public static bool ContentTypeExistsById(this Web web, string contentTypeId)
+        {
+            if (string.IsNullOrEmpty(contentTypeId))
+                throw new ArgumentNullException("contentTypeId");
+
+            ContentTypeCollection ctCol = web.ContentTypes;
+            web.Context.Load(ctCol);
+            web.Context.ExecuteQuery();
+            foreach (var item in ctCol)
+            {
+                if (item.Id.StringValue.StartsWith(contentTypeId, StringComparison.OrdinalIgnoreCase))
+                {
+                    return true;
+                }
+            }
+            return false;
+        }
+
+        /// <summary>
+        /// Does content type exists in the web
+        /// </summary>
+        /// <param name="web">Web to be processed</param>
+        /// <param name="contentTypeName">Name of the content type</param>
+        /// <returns>True if the content type exists, false otherwise</returns>
+        public static bool ContentTypeExistsByName(this Web web, string contentTypeName)
+        {
+            if (string.IsNullOrEmpty(contentTypeName))
+                throw new ArgumentNullException("contentTypeName");
+
+            ContentTypeCollection ctCol = web.ContentTypes;
+            IEnumerable<ContentType> results = web.Context.LoadQuery<ContentType>(ctCol.Where(item => item.Name == contentTypeName));
+            web.Context.ExecuteQuery();
+            ContentType ct = results.FirstOrDefault();
+            if (ct != null)
+            {
+                return true;
+            }
+            return false;
+        }
+
+        /// <summary>
+        /// Does content type exist in web
+        /// </summary>
+        /// <param name="web">Web to be processed</param>
+        /// <param name="listTitle">Title of the list to be updated</param>
+        /// <param name="contentTypeID">Complete ID for the content type</param>
+        /// <returns>True if the content type exists, false otherwise</returns>
+        public static bool ContentTypeExistsById(this Web web, string listTitle, string contentTypeId)
+        {
+            if (string.IsNullOrEmpty(listTitle))
+                throw new ArgumentNullException("listTitle");
+
+            if (string.IsNullOrEmpty(contentTypeId))
+                throw new ArgumentNullException("contentTypeId");
+
+            List list = web.GetListByTitle(listTitle);
+            return ContentTypeExistsById(list, contentTypeId);
+        }
+
+        /// <summary>
+        /// Does content type exist in list
+        /// </summary>
+        /// <param name="list">List to update</param>
+        /// <param name="contentTypeID">Complete ID for the content type</param>
+        /// <returns>True if the content type exists, false otherwise</returns>
+        public static bool ContentTypeExistsById(this List list, string contentTypeId)
+        {
+            if (string.IsNullOrEmpty(contentTypeId))
+                throw new ArgumentNullException("contentTypeId");
+
+            if (!list.ContentTypesEnabled)
+            {
+                return false;
+            }
+
+            ContentTypeCollection ctCol = list.ContentTypes;
+            list.Context.Load(ctCol);
+            list.Context.ExecuteQuery();
+
+            foreach (var item in ctCol)
+            {
+                if (item.Id.StringValue.StartsWith(contentTypeId, StringComparison.OrdinalIgnoreCase))
+                {
+                    return true;
+                }
+            }
+            return false;
+        }
+
+        /// <summary>
+        /// Does content type exist in web
+        /// </summary>
+        /// <param name="web">Web to be processed</param>
+        /// <param name="listTitle">Title of the list to be updated</param>
+        /// <param name="contentTypeName">Name of the content type</param>
+        /// <returns>True if the content type exists, false otherwise</returns>
+        public static bool ContentTypeExistsByName(this Web web, string listTitle, string contentTypeName)
+        {
+            if (string.IsNullOrEmpty(listTitle))
+                throw new ArgumentNullException("listTitle");
+
+            if (string.IsNullOrEmpty(contentTypeName))
+                throw new ArgumentNullException("contentTypeName");
+
+            List list = web.GetListByTitle(listTitle);
+            return ContentTypeExistsByName(list, contentTypeName);
+        }
+
+        /// <summary>
+        /// Does content type exist in list
+        /// </summary>
+        /// <param name="list">List to update</param>
+        /// <param name="contentTypeName">Name of the content type</param>
+        /// <returns>True if the content type exists, false otherwise</returns>
+        public static bool ContentTypeExistsByName(this List list, string contentTypeName)
+        {
+            if (string.IsNullOrEmpty(contentTypeName))
+                throw new ArgumentNullException("contentTypeName");
+
+            if (!list.ContentTypesEnabled)
+            {
+                return false;
+            }
+
+            ContentTypeCollection ctCol = list.ContentTypes;
+            IEnumerable<ContentType> results = list.Context.LoadQuery<ContentType>(ctCol.Where(item => item.Name == contentTypeName));
+            list.Context.ExecuteQuery();
+            if (results.FirstOrDefault() != null)
+            {
+                return true;
+            }
+
+            return false;
+        }
+
         /// <summary>
         /// Create a content type based on the classic feature framework structure.
         /// </summary>
@@ -622,7 +934,7 @@
                     attr = fr.Attributes["Hidden"];
                     if (attr != null)
                     {
-                       hidden = attr.Value.ToBoolean();
+                        hidden = attr.Value.ToBoolean();
                     }
                     web.AddFieldToContentTypeById(ctid, frid, required, hidden);
                 }
@@ -675,173 +987,85 @@
         }

         /// <summary>
-        /// Associates field to content type
-        /// </summary>
-        /// <param name="web">Site to be processed - can be root web or sub site</param>
-        /// <param name="id">Complete ID for the content type</param>
-        /// <param name="fieldID">String representation of the field ID (=guid)</param>
-        public static void AddFieldToContentTypeById(this Web web, string contentTypeID, string fieldID, bool required = false, bool hidden = false)
-        {
-            // Get content type
-            ContentType ct = web.GetContentTypeById(contentTypeID);
-            web.Context.Load(ct);
-            web.Context.Load(ct.FieldLinks);
-            web.Context.ExecuteQuery();
-
-            // Get field
-            Field fld = web.Fields.GetById(new Guid(fieldID));
-
-            // Add field association to content type
-            AddFieldToContentType(web, ct, fld, required, hidden);
-        }
-
-        /// <summary>
-        /// Associates field to content type
-        /// </summary>
-        /// <param name="web">Site to be processed - can be root web or sub site</param>
+        /// Return content type by name
+        /// </summary>
+        /// <param name="web">Web to be processed</param>
         /// <param name="contentTypeName">Name of the content type</param>
-        /// <param name="fieldID">Guid representation of the field ID</param>
-        public static void AddFieldToContentTypeByName(this Web web, string contentTypeName, Guid fieldID, bool required = false, bool hidden = false)
-        {
-            // Get content type
-            ContentType ct = web.GetContentTypeByName(contentTypeName);
-            web.Context.Load(ct);
-            web.Context.Load(ct.FieldLinks);
-            web.Context.ExecuteQuery();
-
-            // Get field
-            Field fld = web.Fields.GetById(fieldID);
-
-            // Add field association to content type
-            AddFieldToContentType(web, ct, fld, required, hidden);
-        }
-
-        /// <summary>
-        /// Associates field to content type
-        /// </summary>
-        /// <param name="web">Site to be processed - can be root web or sub site</param>
-        /// <param name="contentType">Content type to associate field to</param>
-        /// <param name="field">Field to associate to the content type</param>
-        /// <param name="required">Optionally make this a required field</param>
-        /// <param name="hidden">Optionally make this a hidden field</param>
-        public static void AddFieldToContentType(this Web web, ContentType contentType, Field field, bool required = false, bool hidden = false)
-        {
-            FieldLinkCreationInformation fldInfo = new FieldLinkCreationInformation();
-            fldInfo.Field = field;
-            contentType.FieldLinks.Add(fldInfo);
-            contentType.Update(true);
-            web.Context.ExecuteQuery();
-
-            web.Context.Load(field);
-            web.Context.ExecuteQuery();
-
-            if (required || hidden)
-            {
-                //Update FieldLink
-                FieldLink flink = contentType.FieldLinks.GetById(field.Id);
-                flink.Required = required;
-                flink.Hidden = hidden;
-                contentType.Update(true);
-                web.Context.ExecuteQuery();
-            }
-        }
-
-        /// <summary>
-        /// Adds content type to list
-        /// </summary>
-        /// <param name="web">Site to be processed - can be root web or sub site</param>
-        /// <param name="listTitle">Title of the list</param>
+        /// <returns>Content type object or null if was not found</returns>
+        public static ContentType GetContentTypeByName(this Web web, string contentTypeName)
+        {
+            if (string.IsNullOrEmpty(contentTypeName))
+                throw new ArgumentNullException("contentTypeName");
+
+            ContentTypeCollection ctCol = web.ContentTypes;
+            IEnumerable<ContentType> results = web.Context.LoadQuery<ContentType>(ctCol.Where(item => item.Name == contentTypeName));
+            web.Context.ExecuteQuery();
+            return results.FirstOrDefault();
+        }
+
+        /// <summary>
+        /// Return content type by Id
+        /// </summary>
+        /// <param name="web">Web to be processed</param>
         /// <param name="contentTypeID">Complete ID for the content type</param>
-        /// <param name="defaultContent">Optionally make this the default content type</param>
-        public static void AddContentTypeToListById(this Web web, string listTitle, string contentTypeId, bool defaultContent = false)
-        {
-            // Get content type instance
-            ContentType contentType = GetContentTypeById(web, contentTypeId);
-            // Add content type to list
-            AddContentTypeToList(web, listTitle, contentType, defaultContent);
-        }
-
-        /// <summary>
-        /// Adds content type to list
-        /// </summary>
-        /// <param name="web">Site to be processed - can be root web or sub site</param>
-        /// <param name="listTitle">Title of the list</param>
+        /// <returns>Content type object or null if was not found</returns>
+        public static ContentType GetContentTypeById(this Web web, string contentTypeId)
+        {
+            if (string.IsNullOrEmpty(contentTypeId))
+                throw new ArgumentNullException("contentTypeId");
+
+            ContentTypeCollection ctCol = web.ContentTypes;
+            web.Context.Load(ctCol);
+            web.Context.ExecuteQuery();
+            foreach (var item in ctCol)
+            {
+                if (item.Id.StringValue.Equals(contentTypeId, StringComparison.OrdinalIgnoreCase))
+                {
+                    return item;
+                }
+            }
+            return null;
+        }
+
+        /// <summary>
+        /// Return content type by name
+        /// </summary>
+        /// <param name="list">List to update</param>
         /// <param name="contentTypeName">Name of the content type</param>
-        /// <param name="defaultContent">Optionally make this the default content type</param>
-        public static void AddContentTypeToListByName(this Web web, string listTitle, string contentTypeName, bool defaultContent = false)
-        {
-            // Get content type instance
-            ContentType contentType = GetContentTypeByName(web, contentTypeName);
-            // Add content type to list
-            AddContentTypeToList(web, listTitle, contentType, defaultContent);
-        }
-
-        /// <summary>
-        /// Adds content type to list
-        /// </summary>
-        /// <param name="web">Site to be processed - can be root web or sub site</param>
-        /// <param name="listTitle">Title of the list</param>
-        /// <param name="contentType">Content type to be added to the list</param>
-        /// <param name="defaultContent">If set true, content type is updated to be default content type for the list</param>
-        public static void AddContentTypeToList(this Web web, string listTitle, ContentType contentType, bool defaultContent = false)
-        {
-            // Get list instances
-            List list = web.GetListByTitle(listTitle);
-            // Add content type to list
-            AddContentTypeToList(list, contentType, defaultContent);
-        }
-
-        /// <summary>
-        /// Add content type to list
-        /// </summary>
-        /// <param name="list">List to add content type to</param>
+        /// <returns>Content type object or null if was not found</returns>
+        public static ContentType GetContentTypeByName(this List list, string contentTypeName)
+        {
+            if (string.IsNullOrEmpty(contentTypeName))
+                throw new ArgumentNullException("contentTypeName");
+
+            ContentTypeCollection ctCol = list.ContentTypes;
+            IEnumerable<ContentType> results = list.Context.LoadQuery<ContentType>(ctCol.Where(item => item.Name == contentTypeName));
+            list.Context.ExecuteQuery();
+            return results.FirstOrDefault();
+        }
+
+        /// <summary>
+        /// Return content type by Id
+        /// </summary>
+        /// <param name="list">List to update</param>
         /// <param name="contentTypeID">Complete ID for the content type</param>
-        /// <param name="defaultContent">If set true, content type is updated to be default content type for the list</param>
-        public static void AddContentTypeToListById(this List list, string contentTypeID, bool defaultContent = false)
-        {
-            Web web = list.ParentWeb;
-            ContentType contentType = GetContentTypeById(web, contentTypeID);
-            AddContentTypeToList(list, contentType, defaultContent);
-        }
-
-        /// <summary>
-        /// Add content type to list
-        /// </summary>
-        /// <param name="list">List to add content type to</param>
-        /// <param name="contentTypeName">Name of the content type</param>
-        /// <param name="defaultContent">If set true, content type is updated to be default content type for the list</param>
-        public static void AddContentTypeToListByName(this List list, string contentTypeName, bool defaultContent = false)
-        {
-            Web web = list.ParentWeb;
-            ContentType contentType = GetContentTypeByName(web, contentTypeName);
-            AddContentTypeToList(list, contentType, defaultContent);
-        }
-
-        /// <summary>
-        /// Add content type to list
-        /// </summary>
-        /// <param name="list">List to add content type to</param>
-        /// <param name="contentType">Content type to add to the list</param>
-        /// <param name="defaultContent">If set true, content type is updated to be default content type for the list</param>
-        public static void AddContentTypeToList(this List list, ContentType contentType, bool defaultContent = false)
-        {
-            if (contentType == null)
-                throw new ArgumentNullException("contentType");
-
-            if (list.ContentTypeExistsById(contentType.Id.StringValue))
-                return;
-
-            list.ContentTypesEnabled = true;
-            list.Update();
-            list.Context.ExecuteQuery();
-
-            list.ContentTypes.AddExistingContentType(contentType);
-            list.Context.ExecuteQuery();
-            //set the default content type
-            if (defaultContent)
-            {
-                SetDefaultContentTypeToList(list, contentType);
-            }
+        /// <returns>Content type object or null if was not found</returns>
+        public static ContentType GetContentTypeById(this List list, string contentTypeId)
+        {
+            if (string.IsNullOrEmpty(contentTypeId))
+                throw new ArgumentNullException("contentTypeId");
+
+            ContentTypeCollection ctCol = list.ContentTypes;
+            list.Context.Load(ctCol);
+            list.Context.ExecuteQuery();
+            foreach (var item in ctCol)
+            {
+                if (item.Id.StringValue.Equals(contentTypeId, StringComparison.OrdinalIgnoreCase))
+                {
+                    return item;
+                }
+            }
+            return null;
         }

         /// <summary>
@@ -929,228 +1153,6 @@
             SetDefaultContentTypeToList(list, contentType.Id.ToString());
         }

-        /// <summary>
-        /// Does content type exists in the web
-        /// </summary>
-        /// <param name="web">Web to be processed</param>
-        /// <param name="contentTypeID">Complete ID for the content type</param>
-        /// <returns>True if the content type exists, false otherwise</returns>
-        public static bool ContentTypeExistsById(this Web web, string contentTypeId)
-        {
-            if (string.IsNullOrEmpty(contentTypeId))
-                throw new ArgumentNullException("contentTypeId");
-
-            ContentTypeCollection ctCol = web.ContentTypes;
-            web.Context.Load(ctCol);
-            web.Context.ExecuteQuery();
-            foreach (var item in ctCol)
-            {
-                if (item.Id.StringValue.StartsWith(contentTypeId, StringComparison.OrdinalIgnoreCase))
-                {
-                    return true;
-                }
-            }
-            return false;
-        }
-
-        /// <summary>
-        /// Does content type exists in the web
-        /// </summary>
-        /// <param name="web">Web to be processed</param>
-        /// <param name="contentTypeName">Name of the content type</param>
-        /// <returns>True if the content type exists, false otherwise</returns>
-        public static bool ContentTypeExistsByName(this Web web, string contentTypeName)
-        {
-            if (string.IsNullOrEmpty(contentTypeName))
-                throw new ArgumentNullException("contentTypeName");
-
-            ContentTypeCollection ctCol = web.ContentTypes;
-            IEnumerable<ContentType> results = web.Context.LoadQuery<ContentType>(ctCol.Where(item => item.Name == contentTypeName));
-            web.Context.ExecuteQuery();
-            ContentType ct = results.FirstOrDefault();
-            if (ct != null)
-            {
-                return true;
-            }
-            return false;
-        }
-
-        /// <summary>
-        /// Does content type exist in web
-        /// </summary>
-        /// <param name="web">Web to be processed</param>
-        /// <param name="listTitle">Title of the list to be updated</param>
-        /// <param name="contentTypeID">Complete ID for the content type</param>
-        /// <returns>True if the content type exists, false otherwise</returns>
-        public static bool ContentTypeExistsById(this Web web, string listTitle, string contentTypeId)
-        {
-            if (string.IsNullOrEmpty(listTitle))
-                throw new ArgumentNullException("listTitle");
-
-            if (string.IsNullOrEmpty(contentTypeId))
-                throw new ArgumentNullException("contentTypeId");
-
-            List list = web.GetListByTitle(listTitle);
-            return ContentTypeExistsById(list, contentTypeId);
-        }
-
-        /// <summary>
-        /// Does content type exist in list
-        /// </summary>
-        /// <param name="list">List to update</param>
-        /// <param name="contentTypeID">Complete ID for the content type</param>
-        /// <returns>True if the content type exists, false otherwise</returns>
-        public static bool ContentTypeExistsById(this List list, string contentTypeId)
-        {
-            if (string.IsNullOrEmpty(contentTypeId))
-                throw new ArgumentNullException("contentTypeId");
-
-            if (!list.ContentTypesEnabled)
-            {
-                return false;
-            }
-
-            ContentTypeCollection ctCol = list.ContentTypes;
-            list.Context.Load(ctCol);
-            list.Context.ExecuteQuery();
-
-            foreach (var item in ctCol)
-            {
-                if (item.Id.StringValue.StartsWith(contentTypeId, StringComparison.OrdinalIgnoreCase))
-                {
-                    return true;
-                }
-            }
-            return false;
-        }
-
-        /// <summary>
-        /// Does content type exist in web
-        /// </summary>
-        /// <param name="web">Web to be processed</param>
-        /// <param name="listTitle">Title of the list to be updated</param>
-        /// <param name="contentTypeName">Name of the content type</param>
-        /// <returns>True if the content type exists, false otherwise</returns>
-        public static bool ContentTypeExistsByName(this Web web, string listTitle, string contentTypeName)
-        {
-            if (string.IsNullOrEmpty(listTitle))
-                throw new ArgumentNullException("listTitle");
-
-            if (string.IsNullOrEmpty(contentTypeName))
-                throw new ArgumentNullException("contentTypeName");
-
-            List list = web.GetListByTitle(listTitle);
-            return ContentTypeExistsByName(list, contentTypeName);
-        }
-
-        /// <summary>
-        /// Does content type exist in list
-        /// </summary>
-        /// <param name="list">List to update</param>
-        /// <param name="contentTypeName">Name of the content type</param>
-        /// <returns>True if the content type exists, false otherwise</returns>
-        public static bool ContentTypeExistsByName(this List list, string contentTypeName)
-        {
-            if (string.IsNullOrEmpty(contentTypeName))
-                throw new ArgumentNullException("contentTypeName");
-
-            if (!list.ContentTypesEnabled)
-            {
-                return false;
-            }
-
-            ContentTypeCollection ctCol = list.ContentTypes;
-            IEnumerable<ContentType> results = list.Context.LoadQuery<ContentType>(ctCol.Where(item => item.Name == contentTypeName));
-            list.Context.ExecuteQuery();
-            if (results.FirstOrDefault() != null)
-            {
-                return true;
-            }
-
-            return false;
-        }
-
-        /// <summary>
-        /// Return content type by name
-        /// </summary>
-        /// <param name="web">Web to be processed</param>
-        /// <param name="contentTypeName">Name of the content type</param>
-        /// <returns>Content type object or null if was not found</returns>
-        public static ContentType GetContentTypeByName(this Web web, string contentTypeName)
-        {
-            if (string.IsNullOrEmpty(contentTypeName))
-                throw new ArgumentNullException("contentTypeName");
-
-            ContentTypeCollection ctCol = web.ContentTypes;
-            IEnumerable<ContentType> results = web.Context.LoadQuery<ContentType>(ctCol.Where(item => item.Name == contentTypeName));
-            web.Context.ExecuteQuery();
-            return results.FirstOrDefault();
-        }
-
-        /// <summary>
-        /// Return content type by Id
-        /// </summary>
-        /// <param name="web">Web to be processed</param>
-        /// <param name="contentTypeID">Complete ID for the content type</param>
-        /// <returns>Content type object or null if was not found</returns>
-        public static ContentType GetContentTypeById(this Web web, string contentTypeId)
-        {
-            if (string.IsNullOrEmpty(contentTypeId))
-                throw new ArgumentNullException("contentTypeId");
-
-            ContentTypeCollection ctCol = web.ContentTypes;
-            web.Context.Load(ctCol);
-            web.Context.ExecuteQuery();
-            foreach (var item in ctCol)
-            {
-                if (item.Id.StringValue.Equals(contentTypeId, StringComparison.OrdinalIgnoreCase))
-                {
-                    return item;
-                }
-            }
-            return null;
-        }
-
-        /// <summary>
-        /// Return content type by name
-        /// </summary>
-        /// <param name="list">List to update</param>
-        /// <param name="contentTypeName">Name of the content type</param>
-        /// <returns>Content type object or null if was not found</returns>
-        public static ContentType GetContentTypeByName(this List list, string contentTypeName)
-        {
-            if (string.IsNullOrEmpty(contentTypeName))
-                throw new ArgumentNullException("contentTypeName");
-
-            ContentTypeCollection ctCol = list.ContentTypes;
-            IEnumerable<ContentType> results = list.Context.LoadQuery<ContentType>(ctCol.Where(item => item.Name == contentTypeName));
-            list.Context.ExecuteQuery();
-            return results.FirstOrDefault();
-        }
-
-        /// <summary>
-        /// Return content type by Id
-        /// </summary>
-        /// <param name="list">List to update</param>
-        /// <param name="contentTypeID">Complete ID for the content type</param>
-        /// <returns>Content type object or null if was not found</returns>
-        public static ContentType GetContentTypeById(this List list, string contentTypeId)
-        {
-            if (string.IsNullOrEmpty(contentTypeId))
-                throw new ArgumentNullException("contentTypeId");
-
-            ContentTypeCollection ctCol = list.ContentTypes;
-            list.Context.Load(ctCol);
-            list.Context.ExecuteQuery();
-            foreach (var item in ctCol)
-            {
-                if (item.Id.StringValue.Equals(contentTypeId, StringComparison.OrdinalIgnoreCase))
-                {
-                    return item;
-                }
-            }
-            return null;
-        }
         #endregion

         #region Localization


Add snippet for PubSub streaming pull

Add snippet for PubSub streaming pull

This is a significantly more involved example than most,
reflecting the complexity of streaming calls.

--- apis/Google.Cloud.PubSub.V1/Google.Cloud.PubSub.V1.Snippets/SubscriberClientSnippets.cs
+++ apis/Google.Cloud.PubSub.V1/Google.Cloud.PubSub.V1.Snippets/SubscriberClientSnippets.cs
@@ -12,11 +12,12 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.

-using Google.Api.Gax;
+using Google.Api.Gax.Grpc;
 using Google.Protobuf;
 using System;
 using System.Collections.Generic;
 using System.Linq;
+using System.Threading;
 using System.Threading.Tasks;
 using Xunit;

@@ -233,5 +234,65 @@
             await client.AcknowledgeAsync(subscriptionName, ackIds);
             // End snippet
         }
+
+        [Fact]
+        public async Task StreamingPull()
+        {
+            string projectId = _fixture.ProjectId;
+            string topicId = _fixture.CreateTopicId();
+            string subscriptionId = _fixture.CreateSubscriptionId();
+
+            // Snippet: StreamingPull(*, *)
+            PublisherClient publisher = PublisherClient.Create();
+            TopicName topicName = new TopicName(projectId, topicId);
+            publisher.CreateTopic(topicName);
+            SubscriberClient subscriber = SubscriberClient.Create();
+            SubscriptionName subscriptionName = new SubscriptionName(projectId, subscriptionId);
+            subscriber.CreateSubscription(subscriptionName, topicName, null, 60);
+
+            // If we don't see all the messages we expect in 10 seconds, we'll cancel the call.
+            CancellationTokenSource cancellationTokenSource = new CancellationTokenSource(TimeSpan.FromSeconds(10));
+            CallSettings callSettings = CallSettings.FromCancellationToken(cancellationTokenSource.Token);
+            SubscriberClient.StreamingPullStream stream = subscriber.StreamingPull(callSettings);
+
+            // The first request must include the subscription name and the stream ack deadline
+            await stream.WriteAsync(new StreamingPullRequest { SubscriptionAsSubscriptionName = subscriptionName, StreamAckDeadlineSeconds = 20 });
+
+            Task pullingTask = Task.Run(async () =>
+            {
+                int messagesSeen = 0;
+                IAsyncEnumerator<StreamingPullResponse> responseStream = stream.ResponseStream;
+
+                // Handle responses as we see them.
+                while (await responseStream.MoveNext())
+                {
+                    StreamingPullResponse response = responseStream.Current;
+                    Console.WriteLine("Received streaming response");
+                    foreach (ReceivedMessage message in response.ReceivedMessages)
+                    {
+                        // Messages can contain any data. We'll assume that we know this
+                        // topic publishes UTF-8-encoded text.
+                        Console.WriteLine($"Message text: {message.Message.Data.ToStringUtf8()}");
+                    }
+                    // Acknowledge the messages we've just seen
+                    await stream.WriteAsync(new StreamingPullRequest { AckIds = { response.ReceivedMessages.Select(rm => rm.AckId) } });
+
+                    // If we've seen all the messages we expect, we can complete the streaming call,
+                    // and our next MoveNext call will return false.
+                    messagesSeen += response.ReceivedMessages.Count;
+                    if (messagesSeen == 3)
+                    {
+                        await stream.WriteCompleteAsync();
+                    }
+                }
+            });
+
+            publisher.Publish(topicName, new[] { new PubsubMessage { Data = ByteString.CopyFromUtf8("Message 1") } });
+            publisher.Publish(topicName, new[] { new PubsubMessage { Data = ByteString.CopyFromUtf8("Message 2") } });
+            publisher.Publish(topicName, new[] { new PubsubMessage { Data = ByteString.CopyFromUtf8("Message 3") } });
+
+            await pullingTask;
+            // End snippet
+        }
     }
 }


Added back button back

Added back button back

--- Synced/Synced/SyncedGame.cs
+++ Synced/Synced/SyncedGame.cs
@@ -94,8 +94,12 @@
         /// <param name="gameTime">Provides a snapshot of timing values.</param>
         protected override void Update(GameTime gameTime)
         {
-            if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed || Keyboard.GetState().IsKeyDown(Keys.Escape) && _lastState.IsKeyUp(Keys.Escape))
+            if (Keyboard.GetState().IsKeyDown(Keys.Escape) && _lastState.IsKeyUp(Keys.Escape))
                 ScreenManager.Instance.HandleBackEvent();
+
+            //TEMP EXIT FOR GAMEPADS
+            if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed)
+                Exit();
             #region Debug
             if (Keyboard.GetState().IsKeyDown(Keys.F11) && _lastState.IsKeyUp(Keys.F11))
             {


Changed BlockLoginJoinEventPayloadHandler to new EventInterface Design

--- src/Booma.Proxy.Client.Unity.Ship/Handlers/Payload/BlockLoginJoinEventPayloadHandler.cs
+++ src/Booma.Proxy.Client.Unity.Ship/Handlers/Payload/BlockLoginJoinEventPayloadHandler.cs
@@ -12,21 +12,23 @@

 namespace Booma.Proxy
 {
-	public class BlockLoginJoinEventPayloadHandler : GameMessageHandler<BlockLobbyJoinEventPayload>
+	[AdditionalRegisterationAs(typeof(ILocalPlayerLobbyJoinEventSubscribable))]
+	[SceneTypeCreate(GameSceneType.PreBlockBurstingScene)]
+	public class BlockLoginJoinEventPayloadHandler : GameMessageHandler<BlockLobbyJoinEventPayload>, ILocalPlayerLobbyJoinEventSubscribable
 	{
 		//TODO: Is it ok to reuse this?
 		private ICharacterSlotSelectedModel SlotModel { get; }

-		private INetworkClientExportable ExportableClient { get; }
-
-		private IDictionary<int, string> LobbyNumberToSceneNameMap { get; } = new LobbyMapToSceneMappingCollection();
+

 		/// <inheritdoc />
-		public BlockLoginJoinEventPayloadHandler(ILog logger, [NotNull] ICharacterSlotSelectedModel slotModel, [NotNull] INetworkClientExportable exportableClient)
+		public event EventHandler<LobbyJoinedEventArgs> OnLocalPlayerLobbyJoined;
+
+		/// <inheritdoc />
+		public BlockLoginJoinEventPayloadHandler(ILog logger, [NotNull] ICharacterSlotSelectedModel slotModel)
 			: base(logger)
 		{
 			SlotModel = slotModel ?? throw new ArgumentNullException(nameof(slotModel));
-			ExportableClient = exportableClient ?? throw new ArgumentNullException(nameof(exportableClient));
 		}

 		/// <inheritdoc />
@@ -35,26 +37,11 @@
 			if(Logger.IsDebugEnabled)
 				Logger.Debug($"**Handling**: {nameof(BlockLobbyJoinEventPayload)}");

-			//We need to make sure the lobby scene is registered
-			if(!LobbyNumberToSceneNameMap.ContainsKey(payload.LobbyNumber))
-			{
-				string lobbyError = $"Tried to enter Lobby: {payload.LobbyNumber} but no lobby for that id was registered.";
-				if(Logger.IsErrorEnabled)
-					Logger.Error(lobbyError);
-
-				throw new InvalidOperationException(lobbyError);
-			}
-
 			//Just set the old char slot to the clientid
 			//It's basically like a slot, like a lobby or party slot.
 			SlotModel.SlotSelected = payload.ClientId;

-			ExportableClient.ExportmanagedClient();
-
-			//TODO: Handle multiple different lobby scenes
-			//Now we need to load the actual lobby
-			//Doing so will require us to load a new lobby scene
-			SceneManager.LoadSceneAsync(LobbyNumberToSceneNameMap[payload.LobbyNumber]).allowSceneActivation = true;
+			OnLocalPlayerLobbyJoined?.Invoke(this, new LobbyJoinedEventArgs(payload.LobbyNumber));

 			//Don't send anything here, the server will send a 0x60 0x6F after this
 			return Task.CompletedTask;


Restrict some more

Restrict some more

--- src/R/Components/Impl/ConnectionManager/Implementation/ViewModel/ConnectionViewModel.cs
+++ src/R/Components/Impl/ConnectionManager/Implementation/ViewModel/ConnectionViewModel.cs
@@ -301,8 +301,16 @@

         private static bool IsValidConnectionName(string name) {
             // Broker derives log name from connection name and hence the connection cannot contain all characters.
-            return !string.IsNullOrWhiteSpace(name) &&
-                   !name.Where(ch => !Char.IsLetterOrDigit(ch) && !_allowedNameChars.Contains(ch)).Any();
+            if (string.IsNullOrWhiteSpace(name)) {
+                return false;
+            }
+            if (!char.IsLetterOrDigit(name[0])) {
+                return false;
+            }
+            if (name.IndexOfOrdinal("..") >= 0) {
+                return false;
+            }
+            return !name.Where(ch => !char.IsLetterOrDigit(ch) && !_allowedNameChars.Contains(ch)).Any();
         }
     }
 }


优化：PostModel中Token未提供的情况下，自动跳过解密步骤

优化：PostModel中Token未提供的情况下，自动跳过解密步骤

--- src/Senparc.Weixin.WxOpen/Senparc.Weixin.WxOpen/MessageHandlers/WxOpenMessageHandler.cs
+++ src/Senparc.Weixin.WxOpen/Senparc.Weixin.WxOpen/MessageHandlers/WxOpenMessageHandler.cs
@@ -188,7 +188,8 @@

             XDocument decryptDoc = postDataDocument;

-            if (_postModel != null && postDataDocument.Root.Element("Encrypt") != null && !string.IsNullOrEmpty(postDataDocument.Root.Element("Encrypt").Value))
+            if (_postModel != null && _postModel.Token.IsNullOrWhiteSpace()
+                && postDataDocument.Root.Element("Encrypt") != null && !string.IsNullOrEmpty(postDataDocument.Root.Element("Encrypt").Value))
             {
                 //使用了加密
                 UsingEcryptMessage = true;


fix: turni squadre

fix: turni squadre

--- src/backend/SO115App.FakePersistance.ExternalAPI/Composizione/GetComposizioneSquadre.cs
+++ src/backend/SO115App.FakePersistance.ExternalAPI/Composizione/GetComposizioneSquadre.cs
@@ -163,7 +163,7 @@
                     {
                         Stato = MappaStato(lstStatiSquadre.Result.Find(statosquadra => statosquadra.IdSquadra.Equals($"{squadra.Codice}_{codiceTurno}"))?.StatoSquadra ?? Costanti.MezzoInSede),
                         Codice = squadra.Codice,
-                        Turno = lstStatiSquadre.Result.FirstOrDefault(c => c.IdSquadra.Equals($"{squadra.Codice}_{codiceTurno}"))?.TurnoSquadra.ToCharArray()[0] ?? squadra.TurnoAttuale.ToCharArray()[0],
+                        Turno = squadra.TurnoAttuale.ToCharArray()[0],
                         Nome = squadra.Descrizione,
                         DiEmergenza = squadra.Emergenza,
                         Distaccamento = lstSedi.Result.FirstOrDefault(d => d.Codice.Equals(squadra.Distaccamento))?.MapDistaccamentoComposizione() ?? null,


Fix - Corretto disaccoppiamento schede contatto

--- src/backend/SO115App.Persistence.MongoDB/GestioneSchedeContatto/UpDateSchedeContatto.cs
+++ src/backend/SO115App.Persistence.MongoDB/GestioneSchedeContatto/UpDateSchedeContatto.cs
@@ -40,12 +40,12 @@
             var replaceOption = new ReplaceOptions();
             replaceOption.IsUpsert = true;

-            _dbContext.SchedeContattoCollection.ReplaceOne(filter, scheda, replaceOption);
+            _dbContext.SchedeContattoCollection.InsertOne(scheda);

             foreach (var schedaMergiata in scheda.Collegate)
             {
                 var filterMerged = Builders<SchedaContatto>.Filter.Eq(s => s.CodiceScheda, schedaMergiata.CodiceScheda);
-                _dbContext.SchedeContattoCollection.ReplaceOne(filterMerged, schedaMergiata, replaceOption);
+                _dbContext.SchedeContattoCollection.InsertOne(schedaMergiata);
             }
         }
     }


Mouse cursor now changes when over statuses that can be toggled.

--- TeamTracker/Default.aspx.cs
+++ TeamTracker/Default.aspx.cs
@@ -349,7 +349,8 @@
       statusActive ?
       ImagePath + "yes.png" :
       ImagePath + "no.png";
-    button.ToolTip = statusActive ? "active" : "";
+    button.Attributes.Add( "status", statusActive ? "active" : "" );
+    button.Style.Add( "cursor", "pointer" );
     button.Click += HandleStatusClick;

     cell.Controls.Add( button );
@@ -416,7 +417,7 @@
     // otherwise add it (to make the status active).
     string command;

-    if( button.ToolTip == "active" )
+    if( button.Attributes[ "status" ] == "active" )
     {
       command =
         string.Format(


resolving conflicts

resolving conflicts

--- TeslaSQL/Agents/Notifier.cs
+++ TeslaSQL/Agents/Notifier.cs
@@ -52,19 +52,20 @@
             //don't add an error to the e-mail if it happens a lot, just report the number of times it happened
             foreach (TError error in errors)
             {
-                ids.Add(error.id);
-                if (aggregateErrors.Exists(x => x.Error.logDate.Date == error.logDate.Date && x.Error.message == error.message))
+                int index = aggregateErrors.FindIndex(x => x.Error.logDate.Date == error.logDate.Date && x.Error.message == error.message);
+                if (index > 0)
                 {
-                    aggregateErrors.First(x => x.Error.logDate.Date == error.logDate.Date && x.Error.message == error.message).Count++;
+                    aggregateErrors[index].Count++;
                 }
                 else
                 {
                     aggregateErrors.Add(new AggregateError(error));
                 }
+                ids.Add(error.id);
             }

-            foreach (AggregateError aggError in aggregateErrors.OrderBy(x => x.Error.logDate)) {
+            foreach (AggregateError aggError in aggregateErrors.OrderBy(x => x.Error.logDate).Reverse()) {
                 var blockBuilder = new StringBuilder();
                 blockBuilder.Append("

 ");
                 blockBuilder.Append(aggError.Error.logDate);
@@ -76,7 +77,16 @@
                 blockBuilder.Append("
");
                 if (aggError.Error.message.StartsWith("Table:"))
                 {
-                    blockBuilder.AppendLine(aggError.Error.message.Substring(0, aggError.Error.message.IndexOf("\n", aggError.Error.message.IndexOf("\n") + 1)));
+                    var lines = aggError.Error.message.Split('\n');
+                    if (lines.Count() > 2)
+                    {
+                        blockBuilder.AppendLine(lines[0]);
+                        blockBuilder.AppendLine(lines[1]);
+                    } else
+                    {
+                        blockBuilder.AppendLine(aggError.Error.message);
+                    }
+
                 }
                 blockBuilder.AppendLine("

");
                 var block = blockBuilder.ToString();
@@ -87,7 +97,14 @@
                 return;
             }
             emailClient.SendEmail(Config.EmailErrorRecipient, "Errors occurred during changetracking", "" + string.Join("", errorBlocks) + "");
-            sourceDataUtils.MarkErrorsSent(ids);
+            if (ids.Count > 0)
+            {
+                sourceDataUtils.MarkErrorsSent(ids);
+            }
+            else
+            {
+                logger.Log("Notifier got run but at the end there were no error ids to mark as complete.", LogLevel.Error);
+            }
         }
     }
 }


halfway there yaaaay me

halfway there yaaaay me

--- TeslaSQL/Agents/Notifier.cs
+++ TeslaSQL/Agents/Notifier.cs
@@ -27,7 +27,7 @@
         }

         public override void Run() {
-            var errors = sourceDataUtils.GetUnsentErrors();
+            IEnumerable<TError> errors = sourceDataUtils.GetUnsentErrors();
             var errorBlocks = new List<string>();
             var ids = new List<int>();


fixed one bug in a UDP test case

fixed one bug in a UDP test case

--- Test/UdpSocketServerTest.cs
+++ Test/UdpSocketServerTest.cs
@@ -37,10 +37,11 @@
             data.AddRange(Encoding.ASCII.GetBytes(SessionID));

             int expectedLen = 36 + 4;
-
-            if (data.Count < expectedLen)
-            {
-                for (var i = 0; i < expectedLen - data.Count; i++)
+            int maxLen = expectedLen - data.Count;
+
+            if (maxLen > 0)
+            {
+                for (var i = 0; i < maxLen; i++)
                 {
                     data.Add(0x00);
                 }


Add testmesage with attachment and no Content Disposition.

--- Tests/MessageBuilderTest.cs
+++ Tests/MessageBuilderTest.cs
@@ -2,6 +2,7 @@
 using System.IO;
 using System.Linq;
 using System.Net.Mail;
+using System.Text;

 namespace S22.Imap.Test {
 	/// <summary>
@@ -38,6 +39,7 @@
 			MailMessage m = MessageBuilder.FromMIME822(
 				Properties.Resources.MailWithZipAttachment);

+			Assert.AreEqual<int>(0, m.AlternateViews.Count);
 			Assert.AreEqual<int>(1, m.Attachments.Count);
 			// Ensure constructed attachment is identical to our resource file.
 			Assert.AreEqual<string>(Properties.Resources.AttachmentName,
@@ -79,6 +81,7 @@

 			// The mail message contains text as well as html and
 			// image/gif and audio/mid MIME parts.
+			// AlternateViews only if multipart/alternative ?
 			Assert.IsFalse(m.IsBodyHtml);
 			Assert.AreEqual<int>(3, m.AlternateViews.Count);

@@ -109,5 +112,70 @@
 					.SequenceEqual(midi));
 			}
 		}
+
+		/// <summary>
+		/// Creates a MailMessage instance from an RFC822/MIME string
+		/// containing attachment without disposition.
+		/// </summary>
+		[TestMethod]
+		[TestCategory("BuildMessageFromMIME822")]
+		public void MessageWithMultipartMixedAttachment()
+		{
+			// The multiparts is manipulated base64 data and not the real files.
+			MailMessage m = MessageBuilder.FromMIME822(
+				"Received: from xxx.xxxxx.com (xx.xxxx.com [123.45.67.89])\r\n" +
+				"\tby xxxx.asxxx.se (Postfix) with ESMTP id E357F2CCC6A\r\n" +
+				"\tfor <faktxxx@xxxxxx.se>; Thu,  7 Feb 2013 17:12:05 +0100 (CET)\r\n" +
+				"MIME-Version: 1.0\r\n" +
+				"From: <invxxxxx@xxxxx.com>\r\n" +
+				"To: <faktxxx@xxxxxx.se>\r\n" +
+				"Date: Thu, 7 Feb 2013 17:12:02 +0100\r\n" +
+				"Subject: Fakt__xxxx___xxxx___07_02_2013\r\n" +
+				"Content-Type: multipart/mixed;\r\n" +
+				"\tboundary=\"--boundary_0_6cb33448-390c-4f02-b75a-2738f1d6dd45\"\r\n" +
+				"Message-ID: <44967f46-57cc-47c4-ab9f-1c450e1d87bb@XXXXI0123.xx.xxxx.com>\r\n" +
+				"\r\n" +
+				"----boundary_0_6cb33448-390c-4f02-b75a-2738f1d6dd45\r\n" +
+				"Content-Type: text/plain; charset=\"utf-8\"\r\n" +
+				"Content-Transfer-Encoding: base64\r\n" +
+				"\r\n" +
+				"U8OkbmRlciBow6RybWVkIMO2dmVyIGJpbGFnb3IgdXRza3Jpdm5hIHNlbmFzdGUgZmFrdHVyZXJp\r\n" +
+				"bmdzZGFnZW4uDQoNCk1lZCB24oCebmxpZyBo4oCebHNuaW5nDQo=\r\n" +
+				"----boundary_0_6cb33448-390c-4f02-b75a-2738f1d6dd45\r\n" +
+				"Content-Type: application/octet-stream; name=\"Fakt_fil_xxxx_20130207.pdf\"\r\n" +
+				"Content-Transfer-Encoding: base64\r\n" +
+				"\r\n" +
+				"JVBERi0xLjMNCiX15Pb8DQoNCjcgMCBvYmogPDwgL1R5cGUgL1hPYmplY3QNCi9TdWJ0eXBl\r\n" +
+				"IC9JbWFnZQ0KL05hbWUgL0kxDQovV2lkdGggNDYxDQovSGVpZ2h0IDExMA0KL0JpdHNQZXJD\r\n" +
+				"b21wb25lbnQgOA0KL0NvbG9yU3BhY2UgL0RldmljZUdyYXkNCi9MZW5ndGggOTUyOCAvRmls\r\n" +
+				"dGVyIFsgL0FTQ0lJODVEZWNvZGUgL0ZsYXRlRGVjb2RlIF0gPj4NCnN0cmVhbQ0KR2IiLyxN\r\n" +
+				"NDU0MFtKcD8/V14uckZCMXQuLUBjRVxBclFMVkgzJW1iWWR0bEpcRkVdO21faT==\r\n" +
+				"----boundary_0_6cb33448-390c-4f02-b75a-2738f1d6dd45--\r\n");
+			// Check From header
+			Assert.AreEqual("", m.From.DisplayName, "Expected no From displayname");
+			Assert.AreEqual("invxxxxx@xxxxx.com", m.From.Address, "Unexpected From address");
+			// Check To header
+			Assert.AreEqual(1, m.To.Count, "Unexpected To address count");
+			Assert.AreEqual("", m.To[0].DisplayName, "Expected no To displayname");
+			Assert.AreEqual("faktxxx@xxxxxx.se", m.To[0].Address, "Unexpected To address");
+
+			Assert.AreEqual("Fakt__xxxx___xxxx___07_02_2013", m.Subject, "Unexpected Subject");
+			Assert.AreEqual(m.Headers["Content-Type"],
+							"multipart/mixed;\tboundary=\"--boundary_0_6cb33448-390c-4f02-b75a-2738f1d6dd45\"",
+							"Unexpected Content-Type");
+
+			Assert.IsFalse(m.IsBodyHtml, "Expected non HTML body");
+			Assert.AreEqual(Encoding.UTF8, m.BodyEncoding, "Unexpected Body Encoding");
+			// Ensure that we get the message correct.
+			Assert.AreEqual(Encoding.UTF8.GetString(Util.Base64Decode(
+				"U8OkbmRlciBow6RybWVkIMO2dmVyIGJpbGFnb3IgdXRza3Jpdm5hIHNlbmFzdGUgZmFrdHVyZXJp" +
+				"bmdzZGFnZW4uDQoNCk1lZCB24oCebmxpZyBo4oCebHNuaW5nDQo=")),
+				m.Body);
+
+			Assert.AreEqual(0, m.AlternateViews.Count, "AlternateViews count missmatch");
+
+			Assert.AreEqual(1, m.Attachments.Count, "Attachment count missmatch");
+			Assert.AreEqual("Fakt_fil_xxxx_20130207.pdf", m.Attachments[0].Name, "Attachment name missmatch");
+		}
 	}
 }


Wrapped TempFile Dispose on a TryCatch in case the file is being used by another process, will not delete the temporary file

--- ThemeEditor.WPF/TempFile.cs
+++ ThemeEditor.WPF/TempFile.cs
@@ -17,8 +17,15 @@

         public void Dispose()
         {
-            if (File.Exists(FilePath))
-                File.Delete(FilePath);
+            try
+            {
+                if (File.Exists(FilePath))
+                    File.Delete(FilePath);
+            }
+            catch (IOException)
+            {
+                // Ignore
+            }
         }
     }
 }