don't depend on CompilerContext but on specific services

--- src/Boo.Lang.Compiler/TypeSystem/Services/BooCodeBuilder.cs
+++ src/Boo.Lang.Compiler/TypeSystem/Services/BooCodeBuilder.cs
@@ -27,6 +27,7 @@
 #endregion

 using System.Linq;
+using Boo.Lang.Compiler.Services;
 using Boo.Lang.Compiler.TypeSystem.Builders;
 using Boo.Lang.Compiler.TypeSystem.Internal;
 using Boo.Lang.Environments;
@@ -42,25 +43,14 @@

 	public class BooCodeBuilder
 	{
-		protected readonly TypeSystemServices _tss;
-		private readonly InternalTypeSystemProvider _internalTypeSystemProvider;
-
-		public BooCodeBuilder()
-		{
-			_tss = My<TypeSystemServices>.Instance;
-			_internalTypeSystemProvider = My<InternalTypeSystemProvider>.Instance;
-		}
+		private readonly EnvironmentProvision<TypeSystemServices> _tss = new EnvironmentProvision<TypeSystemServices>();
+		private readonly EnvironmentProvision<InternalTypeSystemProvider> _internalTypeSystemProvider = new EnvironmentProvision<InternalTypeSystemProvider>();

 		public TypeSystemServices TypeSystemServices
 		{
 			get { return _tss; }
 		}

-		public CompilerContext Context
-		{
-			get { return _tss.Context; }
-		}
-
 		public int GetFirstParameterIndex(TypeMember member)
 		{
 			return member.IsStatic ? 0 : 1;
@@ -68,7 +58,7 @@

 		public Statement CreateFieldAssignment(Field node, Expression initializer)
 		{
-			InternalField fieldEntity = (InternalField)TypeSystem.TypeSystemServices.GetEntity(node);
+			var fieldEntity = (InternalField)TypeSystem.TypeSystemServices.GetEntity(node);
 			return CreateFieldAssignment(node.LexicalInfo, fieldEntity, initializer);
 		}

@@ -85,13 +75,13 @@

 		public Attribute CreateAttribute(System.Type type)
 		{
-			return CreateAttribute(_tss.Map(type));
+			return CreateAttribute(TypeSystemServices.Map(type));
 		}

 		public Attribute CreateAttribute(IType type)
 		{
 			// TODO: check for the existence of a default constructor
-			return CreateAttribute(_tss.GetDefaultConstructor(type));
+			return CreateAttribute(TypeSystemServices.GetDefaultConstructor(type));
 		}

 		public Attribute CreateAttribute(IConstructor constructor)
@@ -111,11 +101,16 @@

 		public Ast.Module CreateModule(string moduleName, string nameSpace)
 		{
-			Ast.Module module = new Ast.Module();
+			var module = new Ast.Module();
 			module.Name = moduleName;
 			if (!string.IsNullOrEmpty(nameSpace)) module.Namespace = new NamespaceDeclaration(nameSpace);
-			_internalTypeSystemProvider.EntityFor(module); // ensures the module is bound
+			InternalTypeSystemProvider.EntityFor(module); // ensures the module is bound
 			return module;
+		}
+
+		private InternalTypeSystemProvider InternalTypeSystemProvider
+		{
+			get { return _internalTypeSystemProvider.Instance; }
 		}

 		public BooClassBuilder CreateClass(string name)
@@ -158,11 +153,9 @@
 		public Expression CreateCast(IType type, Expression target)
 		{
 			if (type == target.ExpressionType)
-			{
 				return target;
-			}
-
-			CastExpression expression = new CastExpression(target.LexicalInfo);
+
+			var expression = new CastExpression(target.LexicalInfo);
 			expression.Type = CreateTypeReference(type);
 			expression.Target = target;
 			expression.ExpressionType = type;
@@ -171,21 +164,21 @@

 		public Expression CreateTypeofExpression(IType type)
 		{
-			TypeofExpression expression = new TypeofExpression();
+			var expression = new TypeofExpression();
 			expression.Type = CreateTypeReference(type);
-			expression.ExpressionType = _tss.TypeType;
+			expression.ExpressionType = TypeSystemServices.TypeType;
 			expression.Entity = type;
 			return expression;
 		}

 		public Expression CreateTypeofExpression(System.Type type)
 		{
-			return CreateTypeofExpression(_tss.Map(type));
+			return CreateTypeofExpression(TypeSystemServices.Map(type));
 		}

 		public ReferenceExpression CreateLabelReference(LabelStatement label)
 		{
-			ReferenceExpression reference = new ReferenceExpression(label.LexicalInfo, label.Name);
+			var reference = new ReferenceExpression(label.LexicalInfo, label.Name);
 			reference.Entity = label.Entity;
 			return reference;
 		}
@@ -204,7 +197,7 @@
 			{
 				sw.Arguments.Add(CreateLabelReference(label));
 			}
-			sw.ExpressionType = _tss.VoidType;
+			sw.ExpressionType = TypeSystemServices.VoidType;
 			return new ExpressionStatement(sw);
 		}

@@ -213,13 +206,13 @@
 			MethodInvocationExpression mie = new MethodInvocationExpression();
 			mie.Target = CreateBuiltinReference(BuiltinFunction.AddressOf);
 			mie.Arguments.Add(CreateMethodReference(method));
-			mie.ExpressionType = _tss.IntPtrType;
+			mie.ExpressionType = TypeSystemServices.IntPtrType;
 			return mie;
 		}

 		public MethodInvocationExpression CreateMethodInvocation(Expression target, MethodInfo method)
 		{
-			return CreateMethodInvocation(target, _tss.Map(method));
+			return CreateMethodInvocation(target, TypeSystemServices.Map(method));
 		}

 		public MethodInvocationExpression CreatePropertyGet(Expression target, IProperty property)
@@ -236,12 +229,12 @@

 		public MethodInvocationExpression CreateMethodInvocation(MethodInfo staticMethod, Expression arg)
 		{
-			return CreateMethodInvocation(_tss.Map(staticMethod), arg);
+			return CreateMethodInvocation(TypeSystemServices.Map(staticMethod), arg);
 		}

 		public MethodInvocationExpression CreateMethodInvocation(MethodInfo staticMethod, Expression arg0, Expression arg1)
 		{
-			return CreateMethodInvocation(_tss.Map(staticMethod), arg0, arg1);
+			return CreateMethodInvocation(TypeSystemServices.Map(staticMethod), arg0, arg1);
 		}

 		public MethodInvocationExpression CreateMethodInvocation(LexicalInfo li, Expression target, IMethod tag, Expression arg)
@@ -311,12 +304,12 @@

 		public TypeReference CreateTypeReference(Type type)
 		{
-			return CreateTypeReference(_tss.Map(type));
+			return CreateTypeReference(TypeSystemServices.Map(type));
 		}

 		public TypeReference CreateTypeReference(LexicalInfo li, Type type)
 		{
-			return CreateTypeReference(li, _tss.Map(type));
+			return CreateTypeReference(li, TypeSystemServices.Map(type));
 		}

 		public TypeReference CreateTypeReference(LexicalInfo li, IType type)
@@ -481,7 +474,7 @@

 		public ReferenceExpression CreateReference(LexicalInfo li, System.Type type)
 		{
-			return CreateReference(li, _tss.Map(type));
+			return CreateReference(li, TypeSystemServices.Map(type));
 		}

 		public ReferenceExpression CreateReference(IType type)
@@ -567,14 +560,14 @@
 		public BoolLiteralExpression CreateBoolLiteral(bool value)
 		{
 			BoolLiteralExpression expression = new BoolLiteralExpression(value);
-			expression.ExpressionType = _tss.BoolType;
+			expression.ExpressionType = TypeSystemServices.BoolType;
 			return expression;
 		}

 		public StringLiteralExpression CreateStringLiteral(string value)
 		{
 			StringLiteralExpression expression = new StringLiteralExpression(value);
-			expression.ExpressionType = _tss.StringType;
+			expression.ExpressionType = TypeSystemServices.StringType;
 			return expression;
 		}

@@ -587,44 +580,42 @@

 		public ArrayLiteralExpression CreateObjectArray(ExpressionCollection items)
 		{
-			return CreateArray(_tss.ObjectArrayType, items);
+			return CreateArray(TypeSystemServices.ObjectArrayType, items);
 		}

 		public ArrayLiteralExpression CreateArray(IType arrayType, ExpressionCollection items)
 		{
-			if (!arrayType.IsArray) throw new ArgumentException(string.Format("'{0}'  is not an array type!", arrayType), "arrayType");
-			ArrayLiteralExpression array = new ArrayLiteralExpression();
+			if (!arrayType.IsArray)
+				throw new ArgumentException(string.Format("'{0}'  is not an array type!", arrayType), "arrayType");
+
+			var array = new ArrayLiteralExpression();
 			array.ExpressionType = arrayType;
 			array.Items.Extend(items);
-			_tss.MapToConcreteExpressionTypes(array.Items);
+			TypeSystemServices.MapToConcreteExpressionTypes(array.Items);
 			return array;
 		}

 		public IntegerLiteralExpression CreateIntegerLiteral(int value)
 		{
-			IntegerLiteralExpression integer = new IntegerLiteralExpression(value);
-			integer.ExpressionType = _tss.IntType;
+			var integer = new IntegerLiteralExpression(value);
+			integer.ExpressionType = TypeSystemServices.IntType;
 			return integer;
 		}

 		public IntegerLiteralExpression CreateIntegerLiteral(long value)
 		{
-			IntegerLiteralExpression integer = new IntegerLiteralExpression(value);
-			integer.ExpressionType = _tss.LongType;
+			var integer = new IntegerLiteralExpression(value);
+			integer.ExpressionType = TypeSystemServices.LongType;
 			return integer;
 		}

 		public SlicingExpression CreateSlicing(Expression target, int begin)
 		{
-			SlicingExpression expression = new SlicingExpression(target,
-												CreateIntegerLiteral(begin));
-
-			IType expressionType = _tss.ObjectType;
-			IArrayType arrayType = target.ExpressionType as IArrayType;
+			var expression = new SlicingExpression(target, CreateIntegerLiteral(begin));
+			var expressionType = TypeSystemServices.ObjectType;
+			var arrayType = target.ExpressionType as IArrayType;
 			if (null != arrayType)
-			{
 				expressionType = arrayType.ElementType;
-			}
 			expression.ExpressionType = expressionType;
 			return expression;
 		}
@@ -649,7 +640,7 @@
 			notNode.Operand = node;
 			notNode.Operator = UnaryOperatorType.LogicalNot;

-			notNode.ExpressionType = _tss.BoolType;
+			notNode.ExpressionType = TypeSystemServices.BoolType;
 			return notNode;
 		}

@@ -691,7 +682,7 @@

 		private void EnsureEntityFor(TypeMember member)
 		{
-			_internalTypeSystemProvider.EntityFor(member);
+			InternalTypeSystemProvider.EntityFor(member);
 		}

 		public Constructor CreateStaticConstructor(TypeDefinition type)
@@ -744,7 +735,7 @@

 		public ExpressionStatement CreateSuperConstructorInvocation(IType baseType)
 		{
-			IConstructor defaultConstructor = _tss.GetDefaultConstructor(baseType);
+			IConstructor defaultConstructor = TypeSystemServices.GetDefaultConstructor(baseType);
 			if (null == defaultConstructor)
 				throw new ArgumentException("No default constructor for type '" + baseType + "'.");
 			return CreateSuperConstructorInvocation(defaultConstructor);
@@ -752,9 +743,9 @@

 		public ExpressionStatement CreateSuperConstructorInvocation(IConstructor defaultConstructor)
 		{
-			MethodInvocationExpression call = new MethodInvocationExpression(new SuperLiteralExpression());
+			var call = new MethodInvocationExpression(new SuperLiteralExpression());
 			call.Target.Entity = defaultConstructor;
-			call.ExpressionType = _tss.VoidType;
+			call.ExpressionType = TypeSystemServices.VoidType;
 			return new ExpressionStatement(call);
 		}

@@ -944,19 +935,19 @@
 											BinaryOperatorType.ReferenceInequality,
 											target,
 											CreateNullLiteral());
-			test.ExpressionType = _tss.BoolType;
+			test.ExpressionType = TypeSystemServices.BoolType;
 			return test;
 		}

 		public RaiseStatement RaiseException(LexicalInfo lexicalInfo, IConstructor exceptionConstructor, params Expression[] args)
 		{
-			Debug.Assert(_tss.IsValidException(exceptionConstructor.DeclaringType));
+			Debug.Assert(TypeSystemServices.IsValidException(exceptionConstructor.DeclaringType));
 			return new RaiseStatement(lexicalInfo, CreateConstructorInvocation(lexicalInfo, exceptionConstructor, args));
 		}

 		public InternalLocal DeclareTempLocal(Method node, IType type)
 		{
-			InternalLocal local = DeclareLocal(node, Context.GetUniqueName(), type);
+			var local = DeclareLocal(node, My<UniqueNameProvider>.Instance.GetUniqueName(), type);
 			local.IsPrivateScope = true;
 			return local;
 		}
@@ -982,11 +973,11 @@
 				{
 					if (parameter.IsParamArray)
 					{
-						parameter.Type = CreateTypeReference(_tss.ObjectArrayType);
+						parameter.Type = CreateTypeReference(TypeSystemServices.ObjectArrayType);
 					}
 					else
 					{
-						parameter.Type = CreateTypeReference(_tss.ObjectType);
+						parameter.Type = CreateTypeReference(TypeSystemServices.ObjectType);
 					}
 				}
 				parameter.Entity = new InternalParameter(parameter, i + delta);


Update notifications

Update notifications

--- build/Build.Enterprise.cs
+++ build/Build.Enterprise.cs
@@ -19,27 +19,27 @@
     DeclaringTypes = new[] { typeof(Build) },
     Members = new[] { nameof(RootDirectory), nameof(Host), nameof(Verbosity) })]
 [DeploymentSlackNotification]
-[BuildStatusSlackNotification]
+[ContinuousBuildSlackNotification]
 partial class Build : IHazSlackCredentials, IHazAzurePipelinesAccessToken, IHazGitHubAccessToken
 {
     string IHazGitHubAccessToken.AccessToken => GitHubToken;

     public class DeploymentSlackNotificationAttribute : CustomSlackNotificationAttribute
     {
-        public override bool ReportBuildAlways => Host is AppVeyor { ProjectSlug: "nuke-deployment" };
+        public override bool ReportBuildAlways => true;

         public override string ReceiverId => Host switch
         {
-            AppVeyor { ProjectSlug: "nuke-deployment", RepositoryBranch: "master" } => "C01SNUZL50V",
-            AppVeyor { ProjectSlug: "nuke-deployment" } => "G01HT7MCQ2D",
+            AppVeyor { ProjectSlug: "nuke-deployment", RepositoryBranch: "master" } => "C01SNUZL50V", // #help
+            AppVeyor { ProjectSlug: "nuke-deployment" } => "G01HT7MCQ2D", // #sponsors
             _ => null
         };
     }

-    public class BuildStatusSlackNotificationAttribute : CustomSlackNotificationAttribute
+    public class ContinuousBuildSlackNotificationAttribute : CustomSlackNotificationAttribute
     {
         public override bool ReportBuildAlways => true;
-        public override string ReceiverId => Host is GitHubActions _ or AppVeyor _ ? "U9S0MU8A3" : null;
+        public override string ReceiverId => "U9S0MU8A3"; // @matkoch
         public override bool ShowCommits => false;
         public override bool ShowTargets => false;

@@ -50,10 +50,14 @@
             GitHubActions { GitHubJob: "windows-latest" } => "1617073157.007100",
             GitHubActions { GitHubJob: "macOS-latest" } => "1617073163.007200",
             GitHubActions { GitHubJob: "ubuntu-latest" } => "1617073169.007300",
-            _ => throw new NotSupportedException(Host.ToString())
+            _ => null
         };

-        public override bool ShouldNotify(NukeBuild build) => ((Build) build).GitRepository.IsOnDevelopBranch();
+        public override bool ShouldNotify(NukeBuild build)
+            => Host is
+                   GitHubActions { GitHubWorkflow: "continuous" } or
+                   AppVeyor { ProjectSlug: "nuke-continuous" } &&
+               ((Build) build).GitRepository.IsOnDevelopBranch();
     }

     public abstract class CustomSlackNotificationAttribute : SlackNotificationAttribute


Remove unused OperationQueue methods

Remove unused OperationQueue methods

--- SQLitePCL.pretty.Async/OperationsQueue.cs
+++ SQLitePCL.pretty.Async/OperationsQueue.cs
@@ -33,7 +33,7 @@
 // Based off of https://github.com/akavache/Akavache/blob/master/Akavache/Portable/KeyedOperationQueue.cs
 namespace SQLitePCL.pretty
 {
-    internal sealed class OperationsQueue : IDisposable
+    internal sealed class OperationsQueue
     {
         private abstract class Operation
         {
@@ -114,22 +114,10 @@
                 return shutdown;
             }
         }
-
-        public void Dispose()
-        {
-            this.DisposeAsync().Wait();
-        }
     }

     internal static class OperationsQueueExtensions
     {
-        public static Task<T> EnqueueOperation<T>(this OperationsQueue This, Func<T> calculationFunc, IScheduler scheduler, CancellationToken cancellationToken)
-        {
-            return This.EnqueueOperation(() =>
-                Observable.Start(() => calculationFunc(), scheduler).ToTask(),
-                cancellationToken);
-        }
-
         public static Task EnqueueOperation(this OperationsQueue This, Action calculationFunc, IScheduler scheduler, CancellationToken cancellationToken)
         {
             return This.EnqueueOperation(() =>


Fix blocking fix.

Fix blocking fix.

--- src/NadekoBot/Modules/Utility/RemindCommands.cs
+++ src/NadekoBot/Modules/Utility/RemindCommands.cs
@@ -32,7 +32,7 @@
 			public async Task Remind(MeOrHere meorhere, string timeStr, [Remainder] string message) {
 				var target = meorhere == MeOrHere.Me ? Context.User.Id : Context.Channel.Id;

-				await RemindInternal(target, meorhere == MeOrHere.Me, timeStr, message).ConfigureAwait(false);
+				var _ = RemindInternal(target, meorhere == MeOrHere.Me, timeStr, message).ConfigureAwait(false);
 			}

 			[MitternachtCommand, Usage, Description, Aliases]
@@ -46,7 +46,7 @@
 					return;
 				}

-				await RemindInternal(channel.Id, false, timeStr, message).ConfigureAwait(false);
+				var _ = RemindInternal(channel.Id, false, timeStr, message).ConfigureAwait(false);
 			}

 			public async Task RemindInternal(ulong targetId, bool isPrivate, string timeStr, [Remainder] string message) {
@@ -102,7 +102,7 @@
 				} catch {
 					// ignored
 				}
-				await Task.Run(() => Service.StartReminder(rem)).ConfigureAwait(false);
+				await Service.StartReminder(rem).ConfigureAwait(false);
 			}

 			[MitternachtCommand, Usage, Description, Aliases]


Add support for array types and decimal

Add support for array types and decimal

--- src/Nest/Resolvers/Writers/TypeMappingWriter.cs
+++ src/Nest/Resolvers/Writers/TypeMappingWriter.cs
@@ -245,8 +245,12 @@

 		private string GetElasticSearchTypeFromType(Type t)
 		{
+			if (t.IsArray)
+				t = t.GetElementType();
+
 			if (t == typeof(string))
 				return "string";
+
 			if (t.IsValueType)
 			{
 				switch (t.Name)
@@ -257,6 +261,7 @@
 						return "long";
 					case "Single":
 						return "float";
+					case "Decimal":
 					case "Double":
 						return "double";
 					case "DateTime":


refactor(new-file-commit): remove CheckoutFileCommit

--- src/PowershellHelper/Commands/New-FileCommit.cs
+++ src/PowershellHelper/Commands/New-FileCommit.cs
@@ -39,18 +39,9 @@
         [Parameter]
         public string Tag { get; set; }

-        [Parameter]
-        public string CheckOutBranchBeforeCommit { get; set; }
-
         protected override void ProcessRecord()
         {
             var gitHelper = new GitRepositoryHelper(RepositoryPath);
-
-            if (!string.IsNullOrWhiteSpace(CheckOutBranchBeforeCommit))
-            {
-                WriteVerbose($"Checking out {CheckOutBranchBeforeCommit}");
-                gitHelper.CheckOut(CheckOutBranchBeforeCommit);
-            }

             WriteVerbose($"CommitFile {FilePath} as {UserName}<{UserEmail}> with {Message}");
             gitHelper.CommitFile(FilePath, UserName, UserEmail, Message);


Some more test checks

Some more test checks

--- src/R/Editor/Test/Outline/OutlineBuilderTest.cs
+++ src/R/Editor/Test/Outline/OutlineBuilderTest.cs
@@ -134,6 +134,10 @@
             args.Should().NotBeNull();
             args.ChangedRange.Start.Should().Be(0);
             args.ChangedRange.End.Should().Be(textBuffer.CurrentSnapshot.Length);
+            args.Regions.Should().HaveCount(2);
+
+            args.Regions[0].DisplayText.Should().Be("# ANAME1");
+            args.Regions[1].DisplayText.Should().Be("# NAME2");
         }
     }
 }


Added check to only show notifications settings if account is present

- This solve a bug with the notification settings which requires a organisation to be created. We have reused the same logic as rename account settings which also requires an account to be created.

--- src/SFA.DAS.EAS.Web/Views/Shared/_Layout.cshtml
+++ src/SFA.DAS.EAS.Web/Views/Shared/_Layout.cshtml
@@ -147,7 +147,7 @@

Change your email address

 									    @if (!DynamicExtensions.ParseHideNavFromViewBag(ViewBag))
 									    {
-
Notification settings

+
Notification settings

 									    }


TileBrushImplHelper is now able to detect cases where we don't need intermediate brush

--- src/Shared/RenderHelpers/TileBrushImplHelper.cs
+++ src/Shared/RenderHelpers/TileBrushImplHelper.cs
@@ -6,6 +6,8 @@
 using Perspex.Media;
 using Perspex.Rendering;
 using Perspex.Layout;
+using Perspex.Media.Imaging;
+using Perspex.Platform;

 namespace Perspex.RenderHelpers
@@ -21,6 +23,8 @@
         private readonly Size _imageSize;
         private readonly VisualBrush _visualBrush;
         private readonly ImageBrush _imageBrush;
+        private Matrix _transform;
+        private Rect _drawRect;

         public bool IsValid { get; }

@@ -61,20 +65,38 @@
             _scale = brush.Stretch.CalculateScaling(DestinationRect.Size, _sourceRect.Size);
             _translate = CalculateTranslate(brush, _sourceRect, DestinationRect, _scale);
             IntermediateSize = CalculateIntermediateSize(_tileMode, targetSize, DestinationRect.Size);
-        }
-
-        public void DrawIntermediate(DrawingContext ctx)
-        {
-            Rect drawRect;
-            var transform = CalculateIntermediateTransform(
+            _transform = CalculateIntermediateTransform(
                 _tileMode,
                 _sourceRect,
                 DestinationRect,
                 _scale,
                 _translate,
-                out drawRect);
-            using (ctx.PushClip(drawRect))
-            using (ctx.PushPostTransform(transform))
+                out _drawRect);
+        }
+
+        public bool NeedsIntermediateSurface
+        {
+            get
+            {
+                if (_imageBrush == null)
+                    return true;
+                if (_transform != Matrix.Identity)
+                    return true;
+                if (_sourceRect.Position != default(Point))
+                    return true;
+                if ((int) _sourceRect.Width != _imageBrush.Source.PixelWidth ||
+                    (int) _sourceRect.Height != _imageBrush.Source.PixelHeight)
+                    return true;
+                return false;
+            }
+        }
+
+        public T GetDirect<T>() => (T) _imageBrush?.Source.PlatformImpl;
+
+        public void DrawIntermediate(DrawingContext ctx)
+        {
+            using (ctx.PushClip(_drawRect))
+            using (ctx.PushPostTransform(_transform))
             {
                 if (_imageBrush != null)
                 {


allow ':' and '"' even if they are disallowed by the spec

--- src/Compilers/CSharp/Portable/Parser/Lexer_StringLiteral.cs
+++ src/Compilers/CSharp/Portable/Parser/Lexer_StringLiteral.cs
@@ -487,7 +487,7 @@
                             return; // premature end of string! let caller complain about unclosed interpolation
                         }
                     }
-                    else if (ch = '{')
+                    else if (ch == '{')
                     {
                         TrySetUnrecoverableError(_lexer.MakeError(_lexer.TextWindow.Position, 1, ErrorCode.ERR_UnexpectedCharacter, ch));
                         _lexer.TextWindow.AdvanceChar();


The parameter has the same default value.

--- osu.Framework/Audio/AdjustableAudioComponent.cs
+++ osu.Framework/Audio/AdjustableAudioComponent.cs
@@ -40,13 +40,13 @@
         /// <summary>
         /// Playback balance of this sample (-1 .. 1 where 0 is centered)
         /// </summary>
-        public readonly BindableDouble Balance = new BindableDouble(0)
+        public readonly BindableDouble Balance = new BindableDouble
         {
             MinValue = -1,
             MaxValue = 1
         };

-        protected readonly BindableDouble BalanceCalculated = new BindableDouble(0)
+        protected readonly BindableDouble BalanceCalculated = new BindableDouble
         {
             MinValue = -1,
             MaxValue = 1


Throw exception on trying to mutate internal children of a popover

--- osu.Framework/Graphics/UserInterface/Popover.cs
+++ osu.Framework/Graphics/UserInterface/Popover.cs
@@ -1,6 +1,7 @@
 // Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
 // See the LICENCE file in the repository root for full licence text.

+using System;
 using osu.Framework.Extensions;
 using osu.Framework.Graphics.Containers;
 using osu.Framework.Graphics.Shapes;
@@ -60,7 +61,7 @@

         protected Popover()
         {
-            InternalChild = BoundingBoxContainer = new Container
+            base.AddInternal(BoundingBoxContainer = new Container
             {
                 AutoSizeAxes = Axes.Both,
                 Children = new[]
@@ -83,7 +84,7 @@
                         };
                     })
                 }
-            };
+            });
         }

         /// <summary>
@@ -138,6 +139,8 @@
             }
         }

+        protected internal sealed override void AddInternal(Drawable drawable) => throw new InvalidOperationException($"Use {nameof(Content)} instead.");
+
         protected class PopoverFocusedOverlayContainer : FocusedOverlayContainer
         {
             protected override bool BlockPositionalInput => true;


formatting

formatting

--- osu.Framework/Graphics/UserInterface/TextBox.cs
+++ osu.Framework/Graphics/UserInterface/TextBox.cs
@@ -85,22 +85,12 @@

             textContainer.Add(cursor);
             textContainer.Add(textFlow);
-
         }

         private void resetSelection()
         {
             selectionStart = selectionEnd;
             cursorAndLayout.Invalidate();
-        }
-
-        private void resetSelection(bool reset)
-        {
-            if (reset)
-            {
-                selectionStart = selectionEnd;
-                cursorAndLayout.Invalidate();
-            }
         }

         protected override void Dispose(bool disposing)
@@ -397,8 +387,9 @@

                     if (selectionEnd == 0)
                     {
-                        //we only clear if you aren't holding shift
-                        resetSelection(!state.Keyboard.ShiftPressed);
+                            //we only clear if you aren't holding shift
+                        if (!state.Keyboard.ShiftPressed)
+                            resetSelection();
                         return true;
                     }

@@ -410,7 +401,8 @@
                         {
                             //if you have something selected and shift is not held down
                             //A selection reset is required to select a word inside the current selection
-                            resetSelection(!state.Keyboard.ShiftPressed);
+                            if(!state.Keyboard.ShiftPressed)
+                                resetSelection();
                             amount = (selectionEnd - lastSpace - 1);
                         }
                          else
@@ -426,7 +418,8 @@

                     if (selectionEnd == text.Length)
                     {
-                        resetSelection(!state.Keyboard.ShiftPressed);
+                        if (!state.Keyboard.ShiftPressed)
+                            resetSelection();
                         return true;
                     }

@@ -436,7 +429,8 @@
                         int nextSpace = text.IndexOf(' ', selectionEnd + 1);
                         if (nextSpace >= 0)
                         {
-                            resetSelection(!state.Keyboard.ShiftPressed);
+                            if (!state.Keyboard.ShiftPressed)
+                                resetSelection();
                             amount = nextSpace - selectionEnd;
                         }
                         else
@@ -552,7 +546,7 @@
                 }
                 else if (getCharacterClosestTo(state.Mouse.Position) < doubleClickWord[0])
                 {
-                    selectionEnd = text.LastIndexOf(' ', getCharacterClosestTo(state.Mouse.Position))+1;
+                    selectionEnd = text.LastIndexOf(' ', getCharacterClosestTo(state.Mouse.Position)) + 1;
                     selectionStart = doubleClickWord[1];
                 }
                 else
@@ -583,7 +577,7 @@
         }

         protected override bool OnDoubleClick(InputState state)
-        {
+        {
             if (textInput?.ImeActive == true) return true;

             if (text.Length == 0) return true;
@@ -638,8 +632,7 @@

         protected override bool OnMouseUp(InputState state, MouseUpEventArgs args)
         {
-            if (doubleClickWord != null)
-                doubleClickWord = null;
+            doubleClickWord = null;
             return true;
         }


Remove duplicated word in comment

Remove duplicated word in comment

Co-authored-by: Salman Ahmed <a7afa2b28823372a757eb860a4c7da8b68c3cb44@gmail.com>

--- osu.Framework/Graphics/UserInterface/TextBox.cs
+++ osu.Framework/Graphics/UserInterface/TextBox.cs
@@ -1006,7 +1006,7 @@
                     if (e.AltPressed)
                         return false;

-                    // same rationale as comment in case statement comment above.
+                    // same rationale as comment in case statement above.
                     if (!e.Repeat)
                         Commit();
                     return true;


Refactor: Make Check Connectionstring via builder generic

--- src/Dirtybase.App/Options/Validators/SqlOptionsValidator.cs
+++ src/Dirtybase.App/Options/Validators/SqlOptionsValidator.cs
@@ -1,5 +1,6 @@
 using System;
 using System.Collections.Generic;
+using System.Data.Common;
 using System.Data.SqlClient;

 namespace Dirtybase.App.Options.Validators
@@ -13,15 +14,15 @@
             {
                 errors.Add(Constants.InvalidConnectionString);
             }
-            errors.AddRange(CheckConnectionString(options.ConnectionString));
+            errors.AddRange(CheckConnectionString<SqlConnectionStringBuilder>(options.ConnectionString));
             return errors;
         }

-        private static IEnumerable<string> CheckConnectionString(string conncetionString)
+        private static IEnumerable<string> CheckConnectionString<TBuilder>(string conncetionString) where TBuilder : DbConnectionStringBuilder
         {
             try
             {
-                new SqlConnectionStringBuilder(conncetionString);
+                Activator.CreateInstance(typeof(TBuilder), conncetionString);
             }
             catch(Exception)
             {


Remove no-longer-necessary Thread.Sleep

Remove no-longer-necessary Thread.Sleep

--- osu.Game.Tests/Beatmaps/IO/ImportBeatmapTest.cs
+++ osu.Game.Tests/Beatmaps/IO/ImportBeatmapTest.cs
@@ -102,10 +102,6 @@

             waitForOrAssert(() => osu.IsLoaded, @"osu! failed to start in a reasonable amount of time");

-            // this is a temporary workaround for database transaction clashes.
-            // see https://github.com/aspnet/EntityFrameworkCore/issues/9994 for more information.
-            Thread.Sleep(1000);
-
             return osu;
         }


Fixed MessageCache GetMany with Before direction

--- src/Discord.Net.WebSocket/Entities/Messages/MessageCache.cs
+++ src/Discord.Net.WebSocket/Entities/Messages/MessageCache.cs
@@ -61,8 +61,10 @@
             else
                 cachedMessageIds = _orderedMessages.Where(x => x > fromMessageId.Value);

+            if (dir == Direction.Before)
+                cachedMessageIds = cachedMessageIds.Reverse();
+
             return cachedMessageIds
-                .Take(limit)
                 .Select(x =>
                 {
                     SocketMessage msg;
@@ -71,6 +73,7 @@
                     return null;
                 })
                 .Where(x => x != null)
+                .Take(limit)
                 .ToImmutableArray();
         }
     }


Fix left over resource file which isn't actually imported

--- osu.Game.Tests/Database/BeatmapImporterTests.cs
+++ osu.Game.Tests/Database/BeatmapImporterTests.cs
@@ -310,6 +310,7 @@
                 }
                 finally
                 {
+                    File.Delete(temp);
                     Directory.Delete(extractedFolder, true);
                 }
             });


Don't handle non-positional input

Don't handle non-positional input

--- osu.Game/Graphics/UserInterface/LoadingLayer.cs
+++ osu.Game/Graphics/UserInterface/LoadingLayer.cs
@@ -34,6 +34,8 @@

             MainContents.RelativeSizeAxes = Axes.None;
         }
+
+        public override bool HandleNonPositionalInput => false;

         protected override bool Handle(UIEvent e)
         {


Fix weird textbox behaviour when entering a random mod seed overflowing int backing

--- osu.Game/Overlays/Settings/SettingsNumberBox.cs
+++ osu.Game/Overlays/Settings/SettingsNumberBox.cs
@@ -36,6 +36,7 @@
                 {
                     numberBox = new OutlinedNumberBox
                     {
+                        LengthLimit = 9, // limited to less than a value that could overflow int32 backing.
                         Margin = new MarginPadding { Top = 5 },
                         RelativeSizeAxes = Axes.X,
                         CommitOnFocusLost = true


[packages,XcodeBuilder,dev] Set the latest version of Xcode according to the Target of the Node passed to the PBXProject

--- packages/XcodeBuilder/dev/Scripts/PBXProject.cs
+++ packages/XcodeBuilder/dev/Scripts/PBXProject.cs
@@ -20,7 +20,17 @@
             this.RootUri = new System.Uri(rootDirectory, System.UriKind.Absolute);
             this.Path = System.IO.Path.Combine(rootDirectory, projectFilename);

-            this.LatestXcodeVersion = EXcodeVersion.V4dot6;
+            var toolset = node.Target.Toolset;
+            var xcodeDetails = toolset as IXcodeDetails;
+            if (null != xcodeDetails)
+            {
+                this.LatestXcodeVersion = xcodeDetails.SupportedVersion;
+            }
+            else
+            {
+                this.LatestXcodeVersion = EXcodeVersion.V4dot6;
+            }
+
             this.NativeTargets = new PBXNativeTargetSection();
             this.FileReferences = new PBXFileReferenceSection();
             this.BuildFiles = new PBXBuildFileSection();
@@ -81,7 +91,7 @@
             private set;
         }

-        public EXcodeVersion LatestXcodeVersion
+        private EXcodeVersion LatestXcodeVersion
         {
             get;
             set;
@@ -177,7 +187,8 @@
             set;
         }

-        private string GetLastUpgradeCheckVersion()
+        private string
+        GetLastUpgradeCheckVersion()
         {
             switch (this.LatestXcodeVersion)
             {


[trunk] Xcode 5 wants ONLY_ACTIVE_ARCH for Debug configurations

--- packages/XcodeBuilder/dev/Scripts/PreExecute.cs
+++ packages/XcodeBuilder/dev/Scripts/PreExecute.cs
@@ -40,6 +40,11 @@
             {
                 var genericBuildConfiguration = this.Project.BuildConfigurations.Get(config.ToString(), "Generic");
                 genericBuildConfiguration.Options["SYMROOT"].AddUnique(Opus.Core.State.BuildRoot);
+                if (config == Opus.Core.EConfiguration.Debug)
+                {
+                    // Xcode 5 wants this setting for build performance in debug
+                    genericBuildConfiguration.Options["ONLY_ACTIVE_ARCH"].AddUnique("YES");
+                }
                 projectConfigurationList.AddUnique(genericBuildConfiguration);
             }
         }


Fix for comment feed

Fix for comment feed

--- src/FunnelWeb/Model/Repositories/Internal/FeedRepository.cs
+++ src/FunnelWeb/Model/Repositories/Internal/FeedRepository.cs
@@ -43,7 +43,7 @@
                 .QueryOver<Comment>()
                 .Fetch(x=>x.Entry).Eager()
                 .OrderBy(x=>x.Posted).Desc()
-                .Where(x=> !x.IsSpam)
+                .Where(x => x.Status != 0)
                 .Take((skip * take) + take * 10)
                 .Skip(skip)
                 .Take(take)


Contracts format were corrected

Contracts format were corrected

--- src/Infrastructure/Web.Conventions/Responses/ApiResponse.cs
+++ src/Infrastructure/Web.Conventions/Responses/ApiResponse.cs
@@ -86,9 +86,9 @@
         /// </summary>
         /// <typeparam name="TData">Type of respones data</typeparam>
         /// <param name="data">Respones data</param>
-        public static ApiResponse<TData, object> Success<TData>(TData data)
+        public static ApiResponse<TData, int?> Success<TData>(TData data)
         {
-            return new ApiResponse<TData, object>(data, null);
+            return new ApiResponse<TData, int?>(data, null);
         }

         /// <summary>
@@ -96,9 +96,9 @@
         /// </summary>
         /// <typeparam name="TError">Type of respones error</typeparam>
         /// <param name="errors">Errors that happened during request processing</param>
-        public static ApiResponse<object, TError> Error<TError>(IReadOnlyCollection<TError> errors)
+        public static ApiResponse<int?, TError> Error<TError>(IReadOnlyCollection<TError> errors)
         {
-            return new ApiResponse<object, TError>(null, errors.ToArray());
+            return new ApiResponse<int?, TError>(null, errors.ToArray());
         }
     }
 }


fixes PhysicalFileCacheFileSystem file writing

--- src/Smidge/Cache/PhysicalFileCacheFileSystem.cs
+++ src/Smidge/Cache/PhysicalFileCacheFileSystem.cs
@@ -1,4 +1,5 @@
-using Microsoft.Extensions.FileProviders;
+using Microsoft.AspNetCore.Hosting;
+using Microsoft.Extensions.FileProviders;
 using Smidge.Hashing;
 using Smidge.Models;
 using System;
@@ -13,9 +14,11 @@
     public class PhysicalFileCacheFileSystem : ICacheFileSystem
     {
         private readonly IHasher _hasher;
-        private readonly IFileProvider _fileProvider;
+        private readonly PhysicalFileProvider _fileProvider;

-        public PhysicalFileCacheFileSystem(IFileProvider cacheFileProvider, IHasher hasher)
+        public PhysicalFileCacheFileSystem(
+            PhysicalFileProvider cacheFileProvider,
+            IHasher hasher)
         {
             _fileProvider = cacheFileProvider;
             _hasher = hasher;
@@ -66,7 +69,7 @@
             if (string.IsNullOrEmpty(Path.GetExtension(filePath)))
                 throw new InvalidOperationException("The path supplied must contain a file extension.");

-            filePath = filePath.Replace('/', Path.DirectorySeparatorChar);
+            filePath = GetFullFilePathForWriting(filePath);

             Directory.CreateDirectory(Path.GetDirectoryName(filePath));
             using (var writer = File.CreateText(filePath))
@@ -81,13 +84,18 @@
             if (string.IsNullOrEmpty(Path.GetExtension(filePath)))
                 throw new InvalidOperationException("The path supplied must contain a file extension.");

-            filePath = filePath.Replace('/', Path.DirectorySeparatorChar);
+            filePath = GetFullFilePathForWriting(filePath);

             Directory.CreateDirectory(Path.GetDirectoryName(filePath));
             using (var newFile = File.Create(filePath))
             {
                 await contents.CopyToAsync(newFile);
             }
+        }
+
+        private string GetFullFilePathForWriting(string filePath)
+        {
+            return Path.Combine(_fileProvider.Root, filePath.Replace('/', Path.DirectorySeparatorChar));
         }

         /// <summary>


bugfix: fixed extra characters in returned xml response #42

--- src/Spark.Engine/Formatters/XmlFhirFormatter.cs
+++ src/Spark.Engine/Formatters/XmlFhirFormatter.cs
@@ -78,7 +78,7 @@

             return Task.Factory.StartNew(() =>
             {
-                XmlWriter writer = new XmlTextWriter(writeStream, Encoding.UTF8);
+                XmlWriter writer = new XmlTextWriter(writeStream, new UTF8Encoding(false));
                 bool summary = requestMessage.RequestSummary();

                 if (type == typeof(OperationOutcome))
@@ -104,6 +104,4 @@
             });
         }
     }
-
-
 }


SPRNET-1065 -  Extraneous connection open in DataSet operations

--- src/Spring/Spring.Data/Data/Core/AdoTemplate.cs
+++ src/Spring/Spring.Data/Data/Core/AdoTemplate.cs
@@ -329,8 +329,8 @@
             IDbDataAdapter dataAdapter = null;
             try
             {
-                dataAdapter = DbProvider.CreateDataAdapter();
-                //TODO row updated event handling... (SPRNET-1014)
+                dataAdapter = DbProvider.CreateDataAdapter();
+                //TODO row updated event handling...
                 dataAdapter.SelectCommand = DbProvider.CreateCommand();
                 dataAdapter.SelectCommand.Connection = connectionTxPairToUse.Connection;
                 //TODO register for warnings on connection.
@@ -1150,8 +1150,7 @@
             #endregion

             ITableMappingCollection mappingCollection = DoCreateMappingCollection(null);
-            return (int)Execute(new DataAdapterFillCallback(dbProvider,
-                                                            dataTable,
+            return (int)Execute(new DataAdapterFillCallback(dataTable,
                                                             commandType, sql,
                                                             mappingCollection, null, null, null));
         }
@@ -1173,8 +1172,7 @@
                 tableMappingName = "Table";
             }
             ITableMappingCollection mappingCollection = DoCreateMappingCollection(new string[] { tableMappingName });
-            return (int)Execute(new DataAdapterFillCallback(dbProvider,
-                                                            dataTable,
+            return (int)Execute(new DataAdapterFillCallback(dataTable,
                                                             commandType, sql,
                                                             mappingCollection, null, null, null));

@@ -1185,10 +1183,9 @@
         {
             ValidateFillArguments(dataTable, sql, tableMapping);
             ITableMappingCollection mappingCollection = new DataTableMappingCollection();
-            mappingCollection.Add(tableMapping);
-
-            return (int)Execute(new DataAdapterFillCallback(dbProvider,
-                                                            dataTable,
+            mappingCollection.Add((object)tableMapping);
+
+            return (int)Execute(new DataAdapterFillCallback(dataTable,
                                                             commandType, sql,
                                                             mappingCollection, null, null, null));
         }
@@ -1200,8 +1197,7 @@
             ValidateFillArguments(dataTable, sql, tableMapping);
             ITableMappingCollection mappingCollection = new DataTableMappingCollection();
             mappingCollection.Add((object)tableMapping);
-            return (int)Execute(new DataAdapterFillCallback(dbProvider,
-                                                            dataTable,
+            return (int)Execute(new DataAdapterFillCallback(dataTable,
                                                             commandType, sql,
                                                             mappingCollection, setter, null, null));
         }
@@ -1216,7 +1212,7 @@
         {
             ValidateFillWithParameterArguments(dataTable, sql, parameters);
             ITableMappingCollection mappingCollection = DoCreateMappingCollection(null);
-            return (int)Execute(new DataAdapterFillCallback(dbProvider,dataTable,
+            return (int)Execute(new DataAdapterFillCallback(dataTable,
                                                             commandType, sql,
                                                             mappingCollection, null, null,
                                                             parameters));
@@ -1232,7 +1228,7 @@
                 tableMappingName = "Table";
             }
             ITableMappingCollection mappingCollection = DoCreateMappingCollection(new string[] { tableMappingName });
-            return (int)Execute(new DataAdapterFillCallback(dbProvider, dataTable,
+            return (int)Execute(new DataAdapterFillCallback(dataTable,
                                                             commandType, sql,
                                                             mappingCollection, null, null, parameters));
         }
@@ -1244,7 +1240,7 @@
             ValidateFillWithParameterArguments(dataTable, sql, parameters, tableMapping);
             ITableMappingCollection mappingCollection = new DataTableMappingCollection();
             mappingCollection.Add((object)tableMapping);
-            return (int)Execute(new DataAdapterFillCallback(dbProvider, dataTable,
+            return (int)Execute(new DataAdapterFillCallback(dataTable,
                                                             commandType, sql,
                                                             mappingCollection, null, null, parameters));
         }
@@ -1257,7 +1253,7 @@
             ValidateFillWithParameterArguments(dataTable, sql, parameters, tableMapping);
             ITableMappingCollection mappingCollection = new DataTableMappingCollection();
             mappingCollection.Add((object)tableMapping);
-            return (int)Execute(new DataAdapterFillCallback(dbProvider, dataTable,
+            return (int)Execute(new DataAdapterFillCallback(dataTable,
                                                             commandType, sql,
                                                             mappingCollection, dataAdapterSetter, null, parameters));
         }
@@ -1266,7 +1262,7 @@
         #endregion

         #region DataTable Update operations
-
+        //TODO conflict options...

         public int DataTableUpdateWithCommandBuilder(DataTable dataTable,
                                                      CommandType commandType,
@@ -1494,7 +1490,7 @@

             ITableMappingCollection mappingCollection = DoCreateMappingCollection(null);
-            return (int)Execute(new DataAdapterFillCallback(DbProvider, dataSet,
+            return (int)Execute(new DataAdapterFillCallback(dataSet,
                                                             commandType, sql,
                                                             mappingCollection, null, null, null));
         }
@@ -1517,7 +1513,7 @@
                 tableNames = new string[] { "Table" };
             }
             ITableMappingCollection mappingCollection = DoCreateMappingCollection(tableNames);
-            return (int)Execute(new DataAdapterFillCallback(DbProvider, dataSet,
+            return (int)Execute(new DataAdapterFillCallback(dataSet,
                                                             commandType, sql,
                                                             mappingCollection, null, null, null));
         }
@@ -1527,7 +1523,7 @@
                                ITableMappingCollection tableMapping)
         {
             ValidateFillArguments(dataSet, sql, tableMapping);
-            return (int)Execute(new DataAdapterFillCallback(DbProvider, dataSet,
+            return (int)Execute(new DataAdapterFillCallback(dataSet,
                                                             commandType, sql,
                                                             tableMapping, null, null, null));

@@ -1538,7 +1534,7 @@
                                IDataAdapterSetter setter)
         {
             ValidateFillArguments(dataSet, sql, tableMapping);
-            return (int)Execute(new DataAdapterFillCallback(DbProvider, dataSet,
+            return (int)Execute(new DataAdapterFillCallback(dataSet,
                                                             commandType, sql,
                                                             tableMapping, setter, null, null));

@@ -1550,7 +1546,7 @@
                                IDataSetFillLifecycleProcessor fillLifecycleProcessor)
         {
             ValidateFillArguments(dataSet, sql, tableMapping);
-            return (int)Execute(new DataAdapterFillCallback(DbProvider, dataSet,
+            return (int)Execute(new DataAdapterFillCallback(dataSet,
                                                             commandType, sql,
                                                             tableMapping, setter, fillLifecycleProcessor, null));

@@ -1565,7 +1561,7 @@
         {
             ValidateFillWithParameterArguments(dataSet, sql, parameters);
             ITableMappingCollection mappingCollection = DoCreateMappingCollection(null);
-            return (int)Execute(new DataAdapterFillCallback(DbProvider, dataSet,
+            return (int)Execute(new DataAdapterFillCallback(dataSet,
                                                             commandType, sql,
                                                             mappingCollection, null, null,
                                                             parameters));
@@ -1581,7 +1577,7 @@
                 tableNames = new string[] { "Table" };
             }
             ITableMappingCollection tableMapping = DoCreateMappingCollection(tableNames);
-            return (int)Execute(new DataAdapterFillCallback(DbProvider, dataSet,
+            return (int)Execute(new DataAdapterFillCallback(dataSet,
                                                             commandType, sql,
                                                             tableMapping, null, null, parameters));

@@ -1592,7 +1588,7 @@
                                              ITableMappingCollection tableMapping)
         {
             ValidateFillWithParameterArguments(dataSet, sql, parameters, tableMapping);
-            return (int)Execute(new DataAdapterFillCallback(DbProvider, dataSet,
+            return (int)Execute(new DataAdapterFillCallback(dataSet,
                                                             commandType, sql,
                                                             tableMapping, null, null, parameters));
         }
@@ -1603,7 +1599,7 @@
                                              IDataAdapterSetter dataAdapterSetter)
         {
             ValidateFillWithParameterArguments(dataSet, sql, parameters, tableMapping);
-            return (int)Execute(new DataAdapterFillCallback(DbProvider, dataSet,
+            return (int)Execute(new DataAdapterFillCallback(dataSet,
                                                             commandType, sql,
                                                             tableMapping, dataAdapterSetter, null, parameters));
         }
@@ -1615,7 +1611,7 @@
                                              IDataSetFillLifecycleProcessor fillLifecycleProcessor)
         {
             ValidateFillWithParameterArguments(dataSet, sql, parameters, tableMapping);
-            return (int)Execute(new DataAdapterFillCallback(DbProvider, dataSet,
+            return (int)Execute(new DataAdapterFillCallback(dataSet,
                                                             commandType, sql,
                                                             tableMapping, dataAdapterSetter, fillLifecycleProcessor, parameters));
         }
@@ -1685,7 +1681,7 @@

             ITableMappingCollection mappingCollection = DoCreateMappingCollection(new string[] { tableName });

-            return (int)Execute(new DataAdapterUpdateCallback(DbProvider, dataSet,
+            return (int)Execute(new DataAdapterUpdateCallback(dataSet,
                                                               mappingCollection,
                                                               insertCommand,
                                                               updateCommand,
@@ -1726,7 +1722,7 @@
             }
             ITableMappingCollection mappingCollection = DoCreateMappingCollection(new string[] { tableName });

-            int returnVal = (int)Execute(new DataAdapterUpdateCallback(DbProvider, dataSet, mappingCollection,
+            int returnVal = (int)Execute(new DataAdapterUpdateCallback(dataSet, mappingCollection,
                                                                        insertCommand, updateCommand, deleteCommand, null));

             if (insertSql != null)
@@ -1755,7 +1751,7 @@
         {
             ValidateUpdateArguments(dataSet, tableName);
             ITableMappingCollection tableMapping = DoCreateMappingCollection(new string[] { tableName });
-            return (int)Execute(new DataAdapterUpdateCallback(DbProvider, dataSet,
+            return (int)Execute(new DataAdapterUpdateCallback(dataSet,
                                                               tableMapping,
                                                               insertCommand,
                                                               updateCommand,
@@ -1771,7 +1767,7 @@
                                  IDbCommand deleteCommand)
         {
             ValidateUpdateArguments(dataSet, tableMapping);
-            return (int)Execute(new DataAdapterUpdateCallback(DbProvider, dataSet,
+            return (int)Execute(new DataAdapterUpdateCallback(dataSet,
                                                               tableMapping,
                                                               insertCommand,
                                                               updateCommand,
@@ -1787,7 +1783,7 @@
                                  IDataAdapterSetter dataAdapterSetter)
         {
             ValidateUpdateArguments(dataSet, tableMapping);
-            return (int)Execute(new DataAdapterUpdateCallback(DbProvider, dataSet,
+            return (int)Execute(new DataAdapterUpdateCallback(dataSet,
                                                               tableMapping,
                                                               insertCommand,
                                                               updateCommand,
@@ -1877,7 +1873,7 @@
                 ParameterUtils.CopyParameters(deleteCommand, deleteParameters);
             }

-            int returnVal = (int)Execute(new DataAdapterUpdateCallback(DbProvider, dataTable, mappingCollection,
+            int returnVal = (int)Execute(new DataAdapterUpdateCallback(dataTable, mappingCollection,
                                                                        insertCommand, updateCommand, deleteCommand, null));

             if (insertSql != null)
@@ -2165,11 +2161,9 @@
             private ITableMappingCollection mappingCollection;
             private IDataAdapterSetter dataAdapterSetter;
             private IDataSetFillLifecycleProcessor fillLifecycleProcessor;
-            private IDbParameters parameters;
-            private IDbProvider dbProvider;
-
-            public DataAdapterFillCallback(IDbProvider dbProvider,
-                                           DataSet dataSet,
+            private IDbParameters parameters;
+
+            public DataAdapterFillCallback(DataSet dataSet,
                                            CommandType commandType,
                                            string sql,
                                            ITableMappingCollection mappingCollection,
@@ -2177,8 +2171,7 @@
                                            IDataSetFillLifecycleProcessor fillLifecycleProcessor,
                                            IDbParameters parameters)
             {
-                containsDataSet = true;
-                this.dbProvider = dbProvider;
+                containsDataSet = true;
                 this.dataSet = dataSet;
                 this.commandType = commandType;
                 this.sql = sql;
@@ -2186,10 +2179,9 @@
                 this.dataAdapterSetter = dataAdapterSetter;
                 this.fillLifecycleProcessor = fillLifecycleProcessor;
                 this.parameters = parameters;
-            }
-
-            public DataAdapterFillCallback(IDbProvider dbProvider,
-                                           DataTable dataTable,
+            }
+
+            public DataAdapterFillCallback(DataTable dataTable,
                                            CommandType commandType,
                                            string sql,
                                            ITableMappingCollection mappingCollection,
@@ -2197,8 +2189,7 @@
                                            IDataSetFillLifecycleProcessor fillLifecycleProcessor,
                                            IDbParameters parameters)
             {
-                containsDataSet = false;
-                this.dbProvider = dbProvider;
+                containsDataSet = false;
                 this.dataTable = dataTable;
                 this.commandType = commandType;
                 this.sql = sql;
@@ -2211,14 +2202,9 @@

             public object DoInDataAdapter(IDbDataAdapter dataAdapter)
-            {
-                ConnectionTxPair connectionTxPairToUse = ConnectionUtils.GetConnectionTxPair(dbProvider);
-                dataAdapter.SelectCommand.Connection = connectionTxPairToUse.Connection;
-                dataAdapter.SelectCommand.Transaction = connectionTxPairToUse.Transaction;
-
+            {
                 dataAdapter.SelectCommand.CommandType = commandType;
-                dataAdapter.SelectCommand.CommandText = sql;
-
+                dataAdapter.SelectCommand.CommandText = sql;
                 //TODO investigate performance of cloning....would need to change signature to
                 //     DataTableMapping[] otherwise...
                 foreach (DataTableMapping dataTableMapping in mappingCollection)
@@ -2277,13 +2263,16 @@
             private IDbCommand insertCommand;
             private IDbCommand updateCommand;
             private IDbCommand deleteCommand;
-            private IDataAdapterSetter dataAdapterSetter;
-            private IDbProvider dbProvider;
-
-            public DataAdapterUpdateCallback(IDbProvider dbProvider, DataSet dataSet, ITableMappingCollection mappingCollection, IDbCommand insertCommand, IDbCommand updateCommand, IDbCommand deleteCommand, IDataAdapterSetter dataAdapterSetter)
-            {
-                containsDataSet = true;
-                this.dbProvider = dbProvider;
+            private IDataAdapterSetter dataAdapterSetter;
+
+            public DataAdapterUpdateCallback(DataSet dataSet,
+                                             ITableMappingCollection mappingCollection,
+                                             IDbCommand insertCommand,
+                                             IDbCommand updateCommand,
+                                             IDbCommand deleteCommand,
+                                             IDataAdapterSetter dataAdapterSetter)
+            {
+                containsDataSet = true;
                 this.dataSet = dataSet;
                 this.mappingCollection = mappingCollection;
                 this.insertCommand = insertCommand;
@@ -2292,10 +2281,14 @@
                 this.dataAdapterSetter = dataAdapterSetter;
             }

-            public DataAdapterUpdateCallback(IDbProvider dbProvider, DataTable dataTable, ITableMappingCollection mappingCollection, IDbCommand insertCommand, IDbCommand updateCommand, IDbCommand deleteCommand, IDataAdapterSetter dataAdapterSetter)
-            {
-                containsDataSet = false;
-                this.dbProvider = dbProvider;
+            public DataAdapterUpdateCallback(DataTable dataTable,
+                                             ITableMappingCollection mappingCollection,
+                                             IDbCommand insertCommand,
+                                             IDbCommand updateCommand,
+                                             IDbCommand deleteCommand,
+                                             IDataAdapterSetter dataAdapterSetter)
+            {
+                containsDataSet = false;
                 this.dataTable = dataTable;
                 this.mappingCollection = mappingCollection;
                 this.insertCommand = insertCommand;
@@ -2306,11 +2299,7 @@
             #region IDataAdapterCallback Members

             public object DoInDataAdapter(IDbDataAdapter dataAdapter)
-            {
-                ConnectionTxPair connectionTxPairToUse = ConnectionUtils.GetConnectionTxPair(dbProvider);
-                dataAdapter.SelectCommand.Connection = connectionTxPairToUse.Connection;
-                dataAdapter.SelectCommand.Transaction = connectionTxPairToUse.Transaction;
-
+            {
                 //TODO - did not make copies of parameters...
                 if (insertCommand == null && updateCommand == null && deleteCommand == null)
                 {


Fixed enumeration on IPAddressCollection (#117)

* Fixed enumeration on IPAddressCollection

The old enumeration returned the same enumerator (itself) in subsequent calls, meaning a foreach loop will only work once. This commit still allows the legacy behaviour for backwards compatability, but returns a new enumerator for each `GetEnumerator` call. This allows multiple foreach/iterations and fullfils the GetEnumerator contract better.

* Fixed enumerator not resetting at start

* Fixed structure construct error

- IDE issue

--- src/System.Net.IPNetwork/IPAddressCollection.cs
+++ src/System.Net.IPNetwork/IPAddressCollection.cs
@@ -14,8 +14,8 @@
     public class IPAddressCollection : IEnumerable<IPAddress>, IEnumerator<IPAddress> {

         private readonly IPNetwork _ipnetwork;
+        private readonly FilterEnum _filter;
         private BigInteger _enumerator;
-        private readonly FilterEnum _filter;

         internal IPAddressCollection(IPNetwork ipnetwork, FilterEnum filter) {
             this._ipnetwork = ipnetwork;
@@ -25,7 +25,6 @@

         #region Count, Array, Enumerator
-
         public BigInteger Count {
             get {

@@ -62,54 +61,90 @@

         #endregion

-        #region IEnumerable Members
+        #region Legacy Enumeration
+        public IPAddress Current {
+            get {
+                return this[_enumerator];
+            }
+        }

+        object IEnumerator.Current {
+            get {
+                return Current;
+            }
+        }
+
+        public bool MoveNext()
+        {
+            _enumerator++;
+            if (_enumerator >= this.Count) {
+                return false;
+            }
+            return true;
+        }
+
+        public void Reset()
+        {
+            _enumerator = -1;
+        }
+
+        public void Dispose()
+        {
+            // nothing to dispose
+        }
+        #endregion
+
+        #region Enumeration
         IEnumerator<IPAddress> IEnumerable<IPAddress>.GetEnumerator() {
-            return this;
+            return new Enumerator(this);
         }

         IEnumerator IEnumerable.GetEnumerator() {
-            return this;
+            return new Enumerator(this);
         }

-        #region IEnumerator<IPNetwork> Members
+        struct Enumerator : IEnumerator<IPAddress>
+        {
+            private readonly IPAddressCollection _collection;
+            private BigInteger _enumerator;

-        public IPAddress Current {
-            get { return this[this._enumerator]; }
+            object IEnumerator.Current {
+                get {
+                    return Current;
+                }
+            }
+
+            public IPAddress Current {
+                get {
+                    return _collection[_enumerator];
+                }
+            }
+
+            public void Dispose()
+            {
+                // nothing to dispose
+            }
+
+            public bool MoveNext()
+            {
+                _enumerator++;
+                if (_enumerator >= _collection.Count) {
+                    return false;
+                }
+                return true;
+            }
+
+            public void Reset()
+            {
+                _enumerator = -1;
+            }
+
+            public Enumerator(IPAddressCollection collection)
+            {
+                _collection = collection;
+                _enumerator = -1;
+            }
         }
-
-        #endregion
-
-        #region IDisposable Members
-
-        public void Dispose() {
-            // nothing to dispose
-            return;
-        }
-
-        #endregion
-
-        #region IEnumerator Members
-
-        object IEnumerator.Current {
-            get { return this.Current; }
-        }
-
-        public bool MoveNext() {
-            this._enumerator++;
-            if (this._enumerator >= this.Count) {
-                return false;
-            }
-            return true;
-
-        }
-
-        public void Reset() {
-            this._enumerator = -1;
-        }
-
-        #endregion
-
         #endregion
     }
 }


为应用上下文类增加Schemas属性。 :cop:

为应用上下文类增加Schemas属性。 :cop:

--- src/Services/ApplicationContext.cs
+++ src/Services/ApplicationContext.cs
@@ -57,6 +57,7 @@
 		private readonly IList<IApplicationModule> _modules;
 		private readonly IList<IApplicationFilter> _filters;
 		private readonly IDictionary<string, object> _states;
+		private readonly Collections.INamedCollection<ComponentModel.Schema> _schemas;
 		#endregion

 		#region 构造函数
@@ -69,6 +70,7 @@
 			_modules = new List<IApplicationModule>();
 			_filters = new List<IApplicationFilter>();
 			_states = new Dictionary<string, object>(StringComparer.OrdinalIgnoreCase);
+			_schemas = new ComponentModel.SchemaCollection();
 		}
 		#endregion

@@ -145,6 +147,14 @@
 			get => _filters;
 		}

+		public Collections.INamedCollection<ComponentModel.Schema> Schemas
+		{
+			get
+			{
+				return _schemas;
+			}
+		}
+
 		public IDictionary<string, object> States
 		{
 			get => _states;


Changed dispose behavior

Changed dispose behavior

--- src/SimpleSOAPClient/SoapClient.cs
+++ src/SimpleSOAPClient/SoapClient.cs
@@ -42,11 +42,12 @@
         private readonly bool _disposeHttpClient = true;
         private readonly List<ISoapHandler> _handlers = new List<ISoapHandler>();
         private SoapClientSettings _settings;
+        private bool _disposed;

         /// <summary>
         /// The used HTTP client
         /// </summary>
-        public HttpClient HttpClient { get; }
+        public HttpClient HttpClient { get; private set; }

         #region Constructors

@@ -168,6 +169,9 @@
         public virtual async Task<SoapEnvelope> SendAsync(
             string url, string action, SoapEnvelope requestEnvelope, CancellationToken ct = default(CancellationToken))
         {
+            if (_disposed)
+                throw new ObjectDisposedException(nameof(SoapClient));
+
             var trackingId = Guid.NewGuid();
             var handlersOrderedAsc = _handlers.OrderBy(e => e.Order).ToList();

@@ -263,8 +267,16 @@
         /// <param name="disposing"></param>
         protected virtual void Dispose(bool disposing)
         {
+            if (_disposed)
+                return;
+
             if (disposing && _disposeHttpClient)
                 HttpClient.Dispose();
+
+            HttpClient = null;
+            _handlers.Clear();
+
+            _disposed = true;
         }

         #endregion


docs for metric router

docs for metric router

--- src/Statr/Routing/IMetricRouter.cs
+++ src/Statr/Routing/IMetricRouter.cs
@@ -1,9 +1,20 @@
 namespace Statr.Routing
 {
+    /// <summary>
+    /// The metric router is responsible for taking a metric and routing it to
+    /// the correct metric route.
+    /// </summary>
     public interface IMetricRouter
     {
+        /// <summary>
+        /// The number of metrics processed so far
+        /// </summary>
         ulong NumProcessedMetrics { get; }

+        /// <summary>
+        /// Route a metric
+        /// </summary>
+        /// <param name="metric">The metric to route</param>
         void Route(Metric metric);
     }
 }


Add missing IFD tags for ratings.

Add missing IFD tags for ratings.

--- src/TagLib/IFD/Tags/IFDEntryTag.cs
+++ src/TagLib/IFD/Tags/IFDEntryTag.cs
@@ -594,6 +594,16 @@
 		XMP                                                = 700,

 		/// <summary>
+		///     Rating tag used by Windows (Hex: 0x4746)
+		/// </summary>
+		Rating                                             = 18246,
+
+		/// <summary>
+		///     Rating tag used by Windows, value in percent (Hex: 0x4749)
+		/// </summary>
+		RatingPercent                                      = 18249,
+
+		/// <summary>
 		///     OPI-related. (Hex: 0x800D)
 		///     http://www.awaresystems.be/imaging/tiff/tifftags/imageid.html
 		/// </summary>


Fix some typos in the comments.

Fix some typos in the comments.

--- src/TagLib/Image/ImageBlockFile.cs
+++ src/TagLib/Image/ImageBlockFile.cs
@@ -32,11 +32,11 @@
 	/// <summary>
 	///    Some image file formats are organized as a sequence of mostly
 	///    independent data blocks whose order can be changed. Metadata is
-	///    stored in some of those blocks and when metdata is saved, often the
+	///    stored in some of those blocks and when metadata is saved, often the
 	///    same task remains: Delete some blocks which contain metadata and
 	///    overwrite some blocks with other metadata.
 	///    This class extends <see cref="TagLib.Image.File" /> to provide this
-	///    functionality. Blocks can be marked as metadata and when metdata is
+	///    functionality. Blocks can be marked as metadata and when metadata is
 	///    saved their space is used or they are deleted.
 	/// </summary>
 	public abstract class ImageBlockFile : TagLib.Image.File
@@ -171,7 +171,7 @@

 		/// <summary>
-		///    Adds a range to be treat as metadata.
+		///    Adds a range to be treated as metadata.
 		/// </summary>
 		/// <param name="start">
 		///    A <see cref="System.Int64"/> with the start index of the metadata block


Increment version number.

Increment version number.

--- Shields.Graphs/Properties/AssemblyInfo.cs
+++ Shields.Graphs/Properties/AssemblyInfo.cs
@@ -32,5 +32,5 @@
 // You can specify all the values or you can default the Build and Revision Numbers
 // by using the '*' as shown below:
 // [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.1.0")]
-[assembly: AssemblyFileVersion("1.1.0")]
+[assembly: AssemblyVersion("1.1.1")]
+[assembly: AssemblyFileVersion("1.1.1")]


fixes en DescriptionAttributes

fixes en DescriptionAttributes

--- Signum.Utilities/DescriptionAttributes.cs
+++ Signum.Utilities/DescriptionAttributes.cs
@@ -294,7 +294,7 @@
                     let lt = kvp.Value
                     let doa = GetDescriptionOptions(type)
                     where doa != DescriptionOptions.None
-                    select lt.ExportXml(doa, Culture, IsDefault)
+                    select lt.ExportXml()
                 )
             );

@@ -318,26 +318,30 @@
             if (!isDefault && file == null)
                 return null;

-            var types = (from t in assembly.GetTypes()
-                         let opts = GetDescriptionOptions(t)
-                         where opts != DescriptionOptions.None
-                         let x = file.TryGetC(t.Name)
-                         select LocalizedType.ImportXml(t, opts, cultureInfo, x, isDefault))
-                         .ToDictionary(lt => lt.Type);
-
-            return new LocalizedAssembly
+            var result = new LocalizedAssembly
             {
                 Assembly = assembly,
                 Culture = cultureInfo,
-                IsDefault = isDefault,
-                Types = types
+                IsDefault = isDefault
             };
+
+            result.Types = (from t in assembly.GetTypes()
+                            let opts = GetDescriptionOptions(t)
+                            where opts != DescriptionOptions.None
+                            let x = file.TryGetC(t.Name)
+                            select LocalizedType.ImportXml(t, opts, result, x))
+                            .ToDictionary(lt => lt.Type);
+
+            return result;
         }
     }

     public class LocalizedType
     {
         public Type Type { get; private set; }
+        public LocalizedAssembly Assembly { get; private set; }
+        public DescriptionOptions Options { get; private set; }
+
         public string Description { get; set; }
         public string PluralDescription { get; set; }
         public char? Gender { get; set; }
@@ -346,32 +350,32 @@

         LocalizedType() { }

-        public XElement ExportXml(DescriptionOptions doa, CultureInfo cultureInfo, bool isDefault)
+        public XElement ExportXml()
         {
             return new XElement("Type",
                     new XAttribute("Name", Type.Name),

-                    !doa.IsSetAssert(DescriptionOptions.Description, Type) ||
+                    !Options.IsSetAssert(DescriptionOptions.Description, Type) ||
                     Description == null ||
-                    (isDefault && Description == (Type.SingleAttribute<DescriptionAttribute>().TryCC(t => t.Description) ?? DescriptionManager.CleanTypeName(Type).SpacePascal())) ? null :
+                    (Assembly.IsDefault && Description == (Type.SingleAttribute<DescriptionAttribute>().TryCC(t => t.Description) ?? DescriptionManager.CleanTypeName(Type).SpacePascal())) ? null :
                     new XAttribute("Description", Description),

-                    !doa.IsSetAssert(DescriptionOptions.PluralDescription, Type) ||
+                    !Options.IsSetAssert(DescriptionOptions.PluralDescription, Type) ||
                     PluralDescription == null ||
-                    (PluralDescription == NaturalLanguageTools.Pluralize(Description, cultureInfo)) ? null :
+                    (PluralDescription == NaturalLanguageTools.Pluralize(Description, Assembly.Culture)) ? null :
                     new XAttribute("PluralDescription", PluralDescription),

-                    !doa.IsSetAssert(DescriptionOptions.Gender, Type) ||
+                    !Options.IsSetAssert(DescriptionOptions.Gender, Type) ||
                     Gender == null ||
-                    (Gender == NaturalLanguageTools.GetGender(Description, cultureInfo)) ? null :
+                    (Gender == NaturalLanguageTools.GetGender(Description, Assembly.Culture)) ? null :
                     new XAttribute("Gender", Gender),

-                    !doa.IsSetAssert(DescriptionOptions.Members, Type) ? null :
+                    !Options.IsSetAssert(DescriptionOptions.Members, Type) ? null :
                      (from m in Type.GetProperties(bf).Cast<MemberInfo>().Concat(Type.GetFields(bf))
                       let doam = m.SingleAttribute<DescriptionOptionsAttribute>()
-                      where doa == null || doam.Options.IsSetAssert(DescriptionOptions.Description, m)
+                      where doam == null || doam.Options.IsSetAssert(DescriptionOptions.Description, m)
                       let value = Members.TryGetC(m.Name)
-                      where value != null && (!isDefault || ((Type.SingleAttribute<DescriptionAttribute>().TryCC(t => t.Description) ?? m.Name.NiceName()) != value))
+                      where value != null && (!Assembly.IsDefault || ((Type.SingleAttribute<DescriptionAttribute>().TryCC(t => t.Description) ?? m.Name.NiceName()) != value))
                       select new XElement("Member", new XAttribute("MemberName", m.Name), new XAttribute("Name", value)))
                 );
         }
@@ -386,11 +390,11 @@
                 return type.GetProperties(bf).Concat(type.GetFields(bf).Cast<MemberInfo>());
         }

-        internal static LocalizedType ImportXml(Type type, DescriptionOptions opts, CultureInfo cultureInfo, XElement x, bool isDefault)
+        internal static LocalizedType ImportXml(Type type, DescriptionOptions opts, LocalizedAssembly assembly, XElement x)
         {
             string name = !opts.IsSetAssert(DescriptionOptions.Description, type) ? null :
                 (x == null ? null : x.Attribute("Description").TryCC(xa => xa.Value)) ??
-                (!isDefault ? null : DefaultTypeDescription(type));
+                (!assembly.IsDefault ? null : DefaultTypeDescription(type));

             var xMembers = x == null ? null : x.Elements("Member")
                 .Select(m => KVP.Create(m.Attribute("Name").Value, m.Attribute("Description").Value))
@@ -400,22 +404,25 @@
             LocalizedType result = new LocalizedType
             {
                 Type = type,
+                Options = opts,
+                Assembly = assembly,
+
                 Description = name,
                 PluralDescription = !opts.IsSetAssert(DescriptionOptions.PluralDescription, type) ? null :
                              ((x == null ? null : x.Attribute("PluralDescription").TryCC(xa => xa.Value)) ??
-                             (!isDefault ? null : type.SingleAttribute<PluralDescriptionAttribute>().TryCC(t => t.PluralDescription)) ??
-                             (name == null ? null : NaturalLanguageTools.Pluralize(name, cultureInfo))),
+                             (!assembly.IsDefault ? null : type.SingleAttribute<PluralDescriptionAttribute>().TryCC(t => t.PluralDescription)) ??
+                             (name == null ? null : NaturalLanguageTools.Pluralize(name, assembly.Culture))),

                 Gender = !opts.IsSetAssert(DescriptionOptions.Gender, type) ? null :
                          ((x == null ? null : x.Attribute("Gender").TryCS(xa => xa.Value.Single())) ??
-                         (!isDefault ? null : type.SingleAttribute<GenderAttribute>().TryCS(t => t.Gender)) ??
-                         (name == null ? null : NaturalLanguageTools.GetGender(name, cultureInfo))),
+                         (!assembly.IsDefault ? null : type.SingleAttribute<GenderAttribute>().TryCS(t => t.Gender)) ??
+                         (name == null ? null : NaturalLanguageTools.GetGender(name, assembly.Culture))),

                 Members = !opts.IsSetAssert(DescriptionOptions.Members, type) ? null :
                           (from m in GetMembers(type)
                            let mta = m.SingleAttribute<DescriptionOptionsAttribute>()
                            where mta == null || mta.Options.IsSetAssert(DescriptionOptions.Description, m)
-                           let value = xMembers.TryGetC(m.Name) ?? (!isDefault ? null : DefaultMemberDescription(m))
+                           let value = xMembers.TryGetC(m.Name) ?? (!assembly.IsDefault ? null : DefaultMemberDescription(m))
                            where value != null
                            select KVP.Create(m.Name, value))
                            .ToDictionary()


Update EnumExtension.cs

Update EnumExtension.cs

--- Simple.Common/Extensions/EnumExtension.cs
+++ Simple.Common/Extensions/EnumExtension.cs
@@ -1,5 +1,6 @@
 using System;
 using System.Collections.Generic;
+using System.ComponentModel;
 using System.Linq;
 using System.Text;

@@ -14,5 +15,149 @@

             return (value & flagVal) == flagVal;
         }
+
+        public static string GetDescription(this Enum obj)
+        {
+            return GetDescription(obj, true);
+        }
+
+        public static string GetDescription(this Enum obj, bool isAppendDefault)
+        {
+            List<string> list = obj.ToString().Replace("\u0020", string.Empty).Split('\u002c').ToList();
+            Type type = obj.GetType();
+            string result = string.Empty;
+
+            foreach (var item in list)
+            {
+                string name = Enum.GetName(type, Enum.Parse(type, item));
+
+                if (string.IsNullOrEmpty(name))
+                {
+                    continue;
+                }
+
+                object[] atts = type.GetField(name).GetCustomAttributes(typeof(DescriptionAttribute), false);
+                if (atts != null && atts.Length > 0)
+                {
+                    var description = ((DescriptionAttribute)atts[0]).Description;
+
+                    if (!string.IsNullOrEmpty(description))
+                    {
+                        result = result + ((DescriptionAttribute)atts[0]).Description + "\u3001";
+                        continue;
+                    }
+                }
+
+                if (isAppendDefault)
+                {
+                    result = result + name + "\u3001";
+                }
+            }
+
+            return result.Trim('\u3001');
+        }
+
+        public static List<string> GetDescriptions(this Enum obj)
+        {
+            return GetDescriptions(obj, true);
+        }
+
+        public static List<string> GetDescriptions(this Enum obj, bool isAppendDefault)
+        {
+            var source = obj.ToString().Replace("\u0020", string.Empty).Split('\u002c').ToList();
+            var type = obj.GetType();
+            var result = new List<string>();
+
+            foreach (var item in source)
+            {
+                string name = Enum.GetName(type, Enum.Parse(type, item));
+
+                if (string.IsNullOrEmpty(name))
+                {
+                    continue;
+                }
+
+                object[] atts = type.GetField(name).GetCustomAttributes(typeof(DescriptionAttribute), false);
+                if (atts != null && atts.Length > 0)
+                {
+                    var description = ((DescriptionAttribute)atts[0]).Description;
+
+                    if (!string.IsNullOrEmpty(description))
+                    {
+                        result.Add(description);
+                        continue;
+                    }
+                }
+
+                if (isAppendDefault)
+                {
+                    result.Add(name);
+                }
+            }
+
+            return result;
+        }
+
+        public static string GetName(this Enum obj)
+        {
+            return Enum.GetName(obj.GetType(), obj);
+        }
+
+        public static Int32 ToInt32(this Enum obj)
+        {
+            return Convert.ToInt32(obj);
+        }
+
+        public static Byte ToByte(this Enum obj)
+        {
+            return Convert.ToByte(obj);
+        }
+
+        public static string[] ToStringArray(this Enum obj)
+        {
+            var result = obj.ToString().Replace("\u0020", string.Empty).Split('\u002c');
+            return result;
+        }
+
+        public static int[] ToIntArray(this Enum obj)
+        {
+            var type = obj.GetType();
+            var list = ToStringArray(obj);
+            var result = new int[list.Length];
+            for (int i = 0; i < list.Length; i++)
+            {
+                result[i] = (int)Enum.Parse(type, list[i]);
+            }
+
+            return result;
+        }
+
+        public static Tuple<string, int>[] ToTuples(this Enum obj)
+        {
+
+            var type = obj.GetType();
+            var list = ToStringArray(obj);
+            var result = new Tuple<string, int>[list.Length];
+
+            for (int i = 0; i < list.Length; i++)
+            {
+                result[i] = Tuple.Create(list[i], (int)Enum.Parse(type, list[i]));
+            }
+
+            return result;
+        }
+
+        public static KeyValuePair<string, int>[] ToKeyValues(this Enum obj)
+        {
+            var type = obj.GetType();
+            var list = ToStringArray(obj);
+            var result = new KeyValuePair<string, int>[list.Length];
+            for (int i = 0; i < list.Length; i++)
+            {
+                result[i] = new KeyValuePair<string, int>(list[i], (int)Enum.Parse(type, list[i]));
+            }
+
+            return result;
+        }
     }
 }


Fix for #91 - Turn some commonly allocated types into structs

These types are allocated for every state transition in the parser (State)
or every character that's read (character reference) and are fairly
compact. Turning them into structs will remove a significant number of unnecessary
allocations in the parser.

For our razor code generation benchmark, making these changes yields about
500-750ms of speedup (out of 40000ms) or about 1%.

--- src/Microsoft.AspNet.Razor/Text/LineTrackingStringBuffer.cs
+++ src/Microsoft.AspNet.Razor/Text/LineTrackingStringBuffer.cs
@@ -114,16 +114,19 @@
             return null;
         }

-        internal class CharacterReference
+        internal struct CharacterReference
         {
+            private readonly char _character;
+            private readonly SourceLocation _location;
+
             public CharacterReference(char character, SourceLocation location)
             {
-                Character = character;
-                Location = location;
+                _character = character;
+                _location = location;
             }

-            public char Character { get; private set; }
-            public SourceLocation Location { get; private set; }
+            public char Character { get { return _character; } }
+            public SourceLocation Location { get { return _location; } }
         }

         private class TextLine


Fail if you can't connect to LocationService the first time (#3101)

--- src/Microsoft.VisualStudio.Services.Agent/LocationServer.cs
+++ src/Microsoft.VisualStudio.Services.Agent/LocationServer.cs
@@ -28,21 +28,16 @@
         {
             ArgUtil.NotNull(jobConnection, nameof(jobConnection));
             _connection = jobConnection;
-            int attemptCount = 5;
-            while (!_connection.HasAuthenticated && attemptCount-- > 0)
+
+            try
             {
-                try
-                {
-                    await _connection.ConnectAsync();
-                    break;
-                }
-                catch (Exception ex) when (attemptCount > 0)
-                {
-                    Trace.Info($"Catch exception during connect. {attemptCount} attempt left.");
-                    Trace.Error(ex);
-                }
-
-                await Task.Delay(100);
+                await _connection.ConnectAsync();
+            }
+            catch (Exception ex)
+            {
+                Trace.Info($"Unable to connect to {_connection.Uri}.");
+                Trace.Error(ex);
+                throw;
             }

             _locationClient = _connection.GetClient<LocationHttpClient>();


Use Synchronized writer for captured results

--- src/NUnitFramework/framework/Internal/Results/TestResult.cs
+++ src/NUnitFramework/framework/Internal/Results/TestResult.cs
@@ -24,7 +24,7 @@
 using System;
 using System.Globalization;
 using System.IO;
-using System.Text.RegularExpressions;
+using System.Text;
 using NUnit.Framework.Interfaces;

 namespace NUnit.Framework.Internal
@@ -58,7 +58,8 @@
         /// </summary>
         private System.Collections.Generic.List<ITestResult> _children;

-        private StringWriter _outWriter;
+        private StringBuilder _output = new StringBuilder();
+        private TextWriter _outWriter;
         private double _duration;

         #endregion
@@ -194,12 +195,16 @@
         /// <summary>
         /// Gets a TextWriter, which will write output to be included in the result.
         /// </summary>
-        public StringWriter OutWriter
+        public TextWriter OutWriter
         {
             get
             {
                 if (_outWriter == null)
-                    _outWriter = new StringWriter();
+#if PORTABLE || SILVERLIGHT
+                    _outWriter = new StringWriter(_output);
+#else
+                    _outWriter = TextWriter.Synchronized(new StringWriter(_output));
+#endif

                 return _outWriter;
             }
@@ -210,14 +215,12 @@
         /// </summary>
         public string Output
         {
-            get { return _outWriter == null
-                ? string.Empty
-                : _outWriter.ToString();  }
-        }
-
-        #endregion
-
-        #region IXmlNodeBuilder Members
+            get { return _output.ToString(); }
+        }
+
+#endregion
+
+#region IXmlNodeBuilder Members

         /// <summary>
         /// Returns the Xml representation of the result.
@@ -286,7 +289,7 @@
             return thisNode;
         }

-        #endregion
+#endregion

         /// <summary>
         /// Adds a child result to this result, setting this result's
@@ -331,7 +334,7 @@
                 }
         }

-        #region Other Public Methods
+#region Other Public Methods

         /// <summary>
         /// Set the result of the test
@@ -475,9 +478,9 @@
             SetResult(resultState, message, stackTrace);
         }

-        #endregion
-
-        #region Helper Methods
+#endregion
+
+#region Helper Methods

         /// <summary>
         /// Adds a reason element to a node and returns it.
@@ -513,6 +516,6 @@
             return targetNode.AddElementWithCDATA("output", Output);
         }

-        #endregion
+#endregion
     }
 }


Clear the runs when we clone the environment

(Otherwise every time new runs are added, we get duplicates.)

--- src/NodaTime.Web/Models/GoogleStorageBenchmarkRepository.cs
+++ src/NodaTime.Web/Models/GoogleStorageBenchmarkRepository.cs
@@ -93,7 +93,7 @@
                 // don't need to worry about the changes involved as we reattach links.
                 var environmentObject = client.GetObject(BucketName, EnvironmentObjectName);
                 var environments = environmentObject.Crc32c == previous.environmentCrc32c
-                    ? previous.Environments.Select(env => env.Clone()).ToList()
+                    ? previous.Environments.Select(env => { var clone = env.Clone(); clone.Runs.Clear(); return clone; }).ToList()
                     : LoadEnvironments(client).OrderBy(e => e.Machine).ThenBy(e => e.TargetFramework).ThenBy(e => e.OperatingSystem).ToList();

                 // Don't just use previous.runsByStorageName blindly - some may have been removed.


Clone environments on change

Clone environments on change

Otherwise we get duplicate runs

--- src/NodaTime.Web/Models/GoogleStorageBenchmarkRepository.cs
+++ src/NodaTime.Web/Models/GoogleStorageBenchmarkRepository.cs
@@ -93,7 +93,9 @@
                 // We won't reload everything from storage, but we'll come up with completely new set of objects each time, so we
                 // don't need to worry about the changes involved as we reattach links.
                 var environmentObject = client.GetObject(BucketName, EnvironmentObjectName);
-                var environments = environmentObject.Crc32c == previous.environmentCrc32c ? previous.Environments : LoadEnvironments(client);
+                var environments = environmentObject.Crc32c == previous.environmentCrc32c
+                    ? previous.Environments.Select(env => env.Clone()).ToList()
+                    : LoadEnvironments(client);

                 // Don't just use previous.runsByStorageName blindly - some may have been removed.
                 var runsByStorageName = new Dictionary<string, BenchmarkRun>();


fix(auth): 修复角色初始化数据不保存的问题

fix(auth): 修复角色初始化数据不保存的问题

--- src/OSharp.Hosting.Core/Identity/RoleSeedDataInitializer.cs
+++ src/OSharp.Hosting.Core/Identity/RoleSeedDataInitializer.cs
@@ -67,6 +67,8 @@
             {
                 return;
             }
+
+            IUnitOfWork unitOfWork = provider.GetUnitOfWork(true);
             RoleManager<Role> roleManager = provider.GetService<RoleManager<Role>>();
             foreach (Role role in entities)
             {
@@ -80,6 +82,8 @@
                     throw new OsharpException($"进行角色种子数据“{role.Name}”同步时出错：{result.ErrorMessage()}");
                 }
             }
+
+            unitOfWork.Commit();
         }
     }
 }


Added table index to DistributedLockRecord.

--- src/Orchard/Tasks/Locking/Migrations/FrameworkMigrations.cs
+++ src/Orchard/Tasks/Locking/Migrations/FrameworkMigrations.cs
@@ -14,6 +14,10 @@
                 .Column<DateTime>("CreatedUtc")
                 .Column<DateTime>("ValidUntilUtc"));

+            SchemaBuilder.AlterTable("DistributedLockRecord", table => {
+                table.CreateIndex("IDX_DistributedLockRecord_Name_ValidUntilUtc_Count", "Name", "ValidUntilUtc", "Count");
+            });
+
             return 1;
         }
     }


Bump version to 0.18

Bump version to 0.18

--- common/SolutionInfo.cs
+++ common/SolutionInfo.cs
@@ -31,6 +31,6 @@
 namespace System
 {
     internal static class AssemblyVersionInformation {
-        internal const string Version = "0.17.0.0";
+        internal const string Version = "0.18.0.0";
     }
 }


WellKnownTypeProvider optimizations

WellKnownTypeProvider optimizations

--- src/Utilities/Compiler/WellKnownTypeProvider.cs
+++ src/Utilities/Compiler/WellKnownTypeProvider.cs
@@ -2,6 +2,8 @@

 using System;
 using System.Collections.Concurrent;
+using System.Collections.Generic;
+using System.Collections.Immutable;
 using System.Diagnostics.CodeAnalysis;
 using Analyzer.Utilities.Extensions;
 using Microsoft.CodeAnalysis;
@@ -39,12 +41,27 @@
         private readonly ConcurrentDictionary<string, INamedTypeSymbol?> _fullNameToTypeMap;

         /// <summary>
+        /// Global cache of full type names (with namespaces) to namespace name parts and simple type name (without namespace),
+        /// so we can query <see cref="IAssemblySymbol.NamespaceNames"/> and <see cref="IAssemblySymbol.TypeNames"/>.
+        /// </summary>
+        /// <remarks>
+        /// Example: "System.Collections.Generic.List`1" => ( [ "System", "Collections", "Generic" ], "List" )
+        ///
+        /// https://github.com/dotnet/roslyn/blob/9e786147b8cb884af454db081bb747a5bd36a086/src/Compilers/CSharp/Portable/Symbols/AssemblySymbol.cs#L455
+        /// suggests the TypeNames collection can be checked to avoid expensive operations.
+        /// </remarks>
+        private static readonly ConcurrentDictionary<string, (ImmutableHashSet<string> NamespaceNames, string SimpleTypeName)> _fullTypeNameToSimpleInfo =
+            new ConcurrentDictionary<string, (ImmutableHashSet<string> NamespaceNames, string SimpleTypeName)>(StringComparer.Ordinal);
+
+        /// <summary>
         /// Attempts to get the type by the full type name.
         /// </summary>
         /// <param name="fullTypeName">Namespace + type name, e.g. "System.Exception".</param>
         /// <param name="namedTypeSymbol">Named type symbol, if any.</param>
         /// <returns>True if found in the compilation, false otherwise.</returns>
-        public bool TryGetOrCreateTypeByMetadataName(string fullTypeName, [NotNullWhen(returnValue: true)] out INamedTypeSymbol? namedTypeSymbol)
+        public bool TryGetOrCreateTypeByMetadataName(
+            string fullTypeName,
+            [NotNullWhen(returnValue: true)] out INamedTypeSymbol? namedTypeSymbol)
         {
             namedTypeSymbol = _fullNameToTypeMap.GetOrAdd(
                 fullTypeName,
@@ -58,13 +75,53 @@
                     var type = Compilation.GetTypeByMetadataName(fullyQualifiedMetadataName);
 #pragma warning restore RS0030 // Do not used banned APIs

-                    type ??= Compilation.Assembly.GetTypeByMetadataName(fullyQualifiedMetadataName);
+                    // sharwell says: Suppose you reference assembly A with public API X.Y, and you reference assembly B with
+                    // internal API X.Y. Even though you can use X.Y from assembly A, compilation.GetTypeByMetadataName will
+                    // fail outright because it finds two types with the same name.
+
+                    ImmutableHashSet<string>? namespaceNames = null;
+                    string? typeName = null;
                     if (type is null)
                     {
+#if NETSTANDARD1_3 // Probably in 2.9.x branch; just cache everything.
+                        (namespaceNames, typeName) = _fullTypeNameToSimpleInfo.GetOrAdd(
+                            fullTypeName,
+                            GetSimpleNameInfoFromFullTypeName);
+#else // Assuming we're on .NET Standard 2.0 or later, cache type names which are probably compile time constants.
+                        if (string.IsInterned(fullTypeName) != null)
+                        {
+                            (namespaceNames, typeName) = _fullTypeNameToSimpleInfo.GetOrAdd(
+                                fullTypeName,
+                                GetSimpleNameInfoFromFullTypeName);
+                        }
+                        else
+                        {
+                            (namespaceNames, typeName) = GetSimpleNameInfoFromFullTypeName(fullTypeName);
+                        }
+#endif
+
+                        if (IsSubsetOfCollection(namespaceNames, Compilation.Assembly.NamespaceNames)
+                            && Compilation.Assembly.TypeNames.Contains(typeName))
+                        {
+                            type = Compilation.Assembly.GetTypeByMetadataName(fullyQualifiedMetadataName);
+                        }
+                    }
+
+                    if (type is null)
+                    {
+                        RoslynDebug.Assert(namespaceNames != null);
+                        RoslynDebug.Assert(typeName != null);
+
                         foreach (var module in Compilation.Assembly.Modules)
                         {
                             foreach (var referencedAssembly in module.ReferencedAssemblySymbols)
                             {
+                                if (!IsSubsetOfCollection(namespaceNames, referencedAssembly.NamespaceNames!)
+                                    || !referencedAssembly.TypeNames.Contains(typeName))
+                                {
+                                    continue;
+                                }
+
                                 var currentType = referencedAssembly.GetTypeByMetadataName(fullyQualifiedMetadataName);
                                 if (currentType is null)
                                 {
@@ -126,5 +183,51 @@
                 && namedTypeSymbol.TypeArguments.Length == 1
                 && typeArgumentPredicate(namedTypeSymbol.TypeArguments[0]);
         }
+
+        private static (ImmutableHashSet<string> NamespaceNames, string SimpleTypeName) GetSimpleNameInfoFromFullTypeName(string fullTypeName)
+        {
+            int plusIndex = fullTypeName.LastIndexOf('+');   // For nested types.
+            int dotIndex = fullTypeName.LastIndexOf('.');
+            int backTickIndex = fullTypeName.LastIndexOf('`');
+
+            int typeStartIndex = Math.Max(dotIndex, plusIndex) + 1;   // Exclude the '+' or '.'; LastIndexOf() returns -1 if not found.
+            int typeEndIndex = backTickIndex >= 0 && backTickIndex > typeStartIndex ? backTickIndex : fullTypeName.Length;
+
+            ImmutableHashSet<string> namespaceNames;
+            if (dotIndex >= 0)
+            {
+                namespaceNames = ImmutableHashSet.Create(
+                    StringComparer.Ordinal,
+                    fullTypeName
+                        .Substring(0, dotIndex >= 0 ? dotIndex : fullTypeName.Length)
+                        .Split('.'));
+            }
+            else
+            {
+                namespaceNames = ImmutableHashSet<string>.Empty;
+            }
+
+            return (namespaceNames, fullTypeName[typeStartIndex..typeEndIndex]);
+        }
+
+        // This would live in ImmutableHashSetsExtensions.cs, but Microsoft.CodeAnalysis.PublicApiAnalyzers.csproj doesn't get
+        // it.
+        private static bool IsSubsetOfCollection<T>(ImmutableHashSet<T> set1, ICollection<T> set2)
+        {
+            if (set1.Count > set2.Count)
+            {
+                return false;
+            }
+
+            foreach (T item in set1)
+            {
+                if (!set2.Contains(item))
+                {
+                    return false;
+                }
+            }
+
+            return true;
+        }
     }
 }